int c;
    double [][] read_img(String fname, int [] num_col) {	BufferedReader in;	DataInputStream in2;	double[][] img;	String line;	StringTokenizer st;	int c;	int i, j, w, h;	/* naive grayscale binary ppm reading. If you know how to, improve it */	try {	    in = new BufferedReader(new FileReader(fname));	    in2 = new DataInputStream(new DataInputStream( new BufferedInputStream( new FileInputStream(fname))));	}	catch (FileNotFoundException e) {	    System.out.println("File "+fname+" not found"); 	    return null;	}	try {	    line = in.readLine();	    	    if (line.compareTo("P5\n") == 0) { /* I only understand this! */		System.out.println(line);		System.out.println("unknown file format "+fname); 		return null;	    }	    in2.skip(line.getBytes().length + 1);	    	    do {		line = in.readLine();		in2.skip(line.getBytes().length + 1);	    } while (line.charAt(0) == '#');	    	    st = new StringTokenizer(line);	    w = Integer.parseInt(st.nextToken());	    h = Integer.parseInt(st.nextToken());	    	    line = in.readLine();	    in2.skip(line.getBytes().length + 1);	    st = new StringTokenizer(line);	    num_col[0] = Integer.parseInt(st.nextToken());	    	    img = new double[w][h];	    	    for (j=0; j<h; j++) {		for (i=0; i<w; i++) {		    img[i][h-j-1] = (double) in2.readUnsignedByte();		}	    }	}	catch (IOException e) {	    System.out.println("Error reading "+fname); 	    return null;	}	return img;    }