It describes, parsing a CSV file without using StringTokenizer in java
import java.io.*; public class Test { public static void main(String args[]) throws IOException { String thisLine; String[] fullText = new String[100]; //number of possible lines in your file int counter = 0; String fName = "C:/Users/Desktop/345_APPLE.txt"; FileInputStream fis = new FileInputStream(fName); DataInputStream myInput = new DataInputStream(fis); while ((thisLine = myInput.readLine()) != null) { System.out.println("---------------------------------\nBegin Parsing"); int sPos = 0; int ePos = 1; int tDelim = 0; String d = ""; int colCount = 0; int collCount = 0; boolean fMe = false; boolean finalCol = false; while ( ePos < thisLine.length()) { sPos = thisLine.indexOf(",", ePos); tDelim = thisLine.indexOf(",\"", ePos); if (tDelim == ePos) { fMe = true; collCount = ePos + 1; while (collCount <= thisLine.indexOf("\",")) { collCount += 1; } colCount += 1; sPos = collCount; } if (colCount == 47) { //Get Max count of columns finalCol = true; collCount = ePos + 1; while (collCount <= thisLine.lastIndexOf("\"")) { collCount += 1; } colCount += 1; sPos = collCount; } if (sPos == -1) { d = thisLine.substring(ePos,thisLine.length()); System.out.println(d); break; }else if(ePos == 1) { d = thisLine.substring(ePos-1,sPos); System.out.println(d); }else{ if (fMe) { d = thisLine.substring(ePos + 1, sPos); fMe = false; }else if (finalCol) { d = thisLine.substring(ePos, sPos); finalCol = false; }else{ d = thisLine.substring(ePos, sPos); } System.out.println(d); } colCount += 1; ePos = sPos + 1; } counter++; fullText[counter] = thisLine; System.out.println("\nEnd Parsing\n---------------------------------\n\n"); } } }