if (currentCode != null && currentPosition != 0 && currentLength != 0) index.add(new Object[]{currentCode, new int[]{currentPosition, currentLength}});
  private void buildCodeDb(File sortedWords) throws FileNotFoundException, IOException {    List codeList = new ArrayList();    BufferedReader reader = new BufferedReader(new FileReader(sortedWords));    String word;    while ((word = reader.readLine()) != null) {      codeList.add(new CodeWord(this.getCode(word), word));    }    reader.close();    Collections.sort(codeList);    List index = new ArrayList();    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(db, FILE_DB)));    String currentCode = null;    int currentPosition = 0;    int currentLength = 0;    for (int i = 0; i < codeList.size(); i++) {      CodeWord cw = (CodeWord) codeList.get(i);      String thisCode = cw.getCode();//            if (thisCode.length() > 3) thisCode = thisCode.substring(0, 3);      thisCode = getIndexCode(thisCode, codeList);      String toWrite = cw.getCode() + "," + cw.getWord() + "\n";      byte[] bytes = toWrite.getBytes();      if (currentCode == null) currentCode = thisCode;      if (!currentCode.equals(thisCode)) {        index.add(new Object[]{currentCode, new int[]{currentPosition, currentLength}});        currentPosition += currentLength;        currentLength = bytes.length;        currentCode = thisCode;      } else {        currentLength += bytes.length;      }      out.write(bytes);    }    out.close();    BufferedWriter writer = new BufferedWriter(new FileWriter(new File(db, FILE_INDEX)));    for (int i = 0; i < index.size(); i++) {      Object[] o = (Object[]) index.get(i);      writer.write(o[0].toString());      writer.write(",");      writer.write(String.valueOf(((int[]) o[1])[0]));      writer.write(",");      writer.write(String.valueOf(((int[]) o[1])[1]));      writer.newLine();    }    writer.close();  }