I have to read data from file Here is data and want plot a graph vs thick(column 1 in data) and alpha(column 3) for every model. Every model has 7 line data,the last that start with 0 not required. Here is my code. it works but i don't think it is good code.please, suggest me better way to do the same.
public class readFile {
public static int showLines(String fileName)  {
    String line;
    int currentLineNo = 0;
    BufferedReader in = null;
    try {
        in = new BufferedReader (new FileReader(fileName));
        //read until endLine
        while(((line = in.readLine()) != null)) {
            if (!line.contains("M") && !line.contains("#") && !line.trim().startsWith("0")) {
                //skipping the line that start with M, # and 0.
                currentLineNo++;
            } 
        }   
    } catch (IOException ex) {
        System.out.println("Problem reading file.\n" + ex.getMessage());
    } finally {
        try { if (in!=null) in.close(); } catch(IOException ignore) {}
    }
    return currentLineNo;
}
//Now we know the dimension of matrix, so storing data into matrix
public static void readData(String fileName,int numRow)  {
    String line;
    String temp []=null;
    String data [][]=new String[numRow][10];
    int i=0;
    BufferedReader in = null;
    try {
        in = new BufferedReader (new FileReader(fileName));
        //read until endLine
        while(((line = in.readLine()) != null)) {
            if (!line.contains("M") && !line.contains("#") && !line.trim().startsWith("0")) {
                    temp=(line.trim().split("[.]"));
                    for (int j = 0; j<data[i].length; j++) {    
                        data[i][j] =temp[j];
                    }
                    i++;
                }
            }
        // Extract one column from 2d matrix
        for (int j = 0; j <numRow; j=j+6) {
            for (int j2=j; j2 <6+j; j2++) {
                System.out.println(Double.parseDouble(data[j2][0])+"\t"+Double.parseDouble(data[j2][2]));  
                //6 element of every model, col1 and col3
                // will add to dataset.
            }
        }
    } catch (IOException ex) {
        System.out.println("Problem reading file.\n" + ex.getMessage());
    } finally {
        try { if (in!=null) in.close(); } catch(IOException ignore) {}
    }
}
//Main Method
public static void main(String[] args) {
    //System.out.println(showLines("rf.txt"));
    readData("rf.txt",showLines("rf.txt") );
}
}
 
    