@SuppressWarnings("deprecation")
    /**
     * Read image
     */
	public void readImage(String filePath) throws IOException {
		
		FileInputStream fileInputStream = new FileInputStream(filePath);
		DataInputStream dis = new DataInputStream(fileInputStream);

		 // look for 4 lines (i.e.: the header) and discard them
		 int numnewlines = 4;
		 String data;
		 String[] tmp;
		 while (numnewlines > 0) {
		     
			 data=dis.readLine();
			 System.out.println(data);
			 if(numnewlines==2){
				 tmp=data.split(" ");
				 picWidth=Integer.parseInt(tmp[0]);
				 picHeight=Integer.parseInt(tmp[1]);
			 }
			 
		     numnewlines--;
		 }
		 // read the image data
		 data2D = new int[picHeight][picWidth];
		 
		 for (int row = 0; row < picHeight; row++) {
			 data=dis.readLine();
			 tmp=data.split(" ");
			 for (int col = 0; col < picWidth; col++) {
				 data2D[row][col] =Integer.parseInt(tmp[col]);
		     }
		 }
		 fileInputStream.close();
	  }