here i have code it work well here i have assigned size of the row and column. how can i get the row and column value from text file.

import java.util.StringTokenizer;
public class csvimport5 {

    public static void main(String[] args) throws IOException {

        File file = new File("D:\\PROJECT_JAVA\\buydata.txt");
        int row = 0;
        int col = 0;
		//Scanner in = new Scanner(;
		double [][] data = new double [87][2];
        BufferedReader bufRdr  = new BufferedReader(new FileReader(file));
        String line = null;
        while((line = bufRdr.readLine()) != null && row < data.length)
			StringTokenizer st = new StringTokenizer(line,",");
			while (st.hasMoreTokens())
				try {
					  data[row][col] = Double.parseDouble(st.nextToken());
					} catch (NumberFormatException e) {
			col = 0;
        System.out.println(" "+data[86][1]);     



what do you mean, get that value?

What does the text file contain? If it has a record with two Strings that are the row and column values, you could use the Scanner class to read and convert those two Strings into int values.
If you read the whole line as a String then you will need to extract the two Strings that are the numbers and convert them to int using the Integer class's parsing method.
I assume that the row and column numbers are int values. You are treating them as double which seems strange as I think of row numbers as whole numbers.

my text file contain 2D matrix double i have assign row and column size(row=87,col=3).i have to find the row and column size before assigning value into matrix.

have to find the row and column size before assigning value into matrix.

Where are the row and column size values? Are they in the file?
If you read the data in the file into an arraylist you would not have to worry about the size of the data, the arraylist will resize itself as needed.

for example


here my file contain 2 column and 5 can i find the row and column size when i change the file.array list is possible but i want 2D matrix to do the calculation

If you read the file into an array list, you will know how many rows there are.
You can then create an array with the correct size and copy the data from the arraylist to the 2D array.

yes.but it will take unnecessary time. do you have any suggestion.

it will take unnecessary time

Please explain what the problem is.