The result is 0 for the counter, but i have binary in my file, does anyone knows why it returns 0? But it works alright when i use FileInputStream and ObjectInputStream. This means my file isn't corrupted or something.Code:int counter=0; Scanner input = new Scanner(new FileReader("/home/huiling/my-cdk/bin.bin")); while(input.hasNextBoolean()==true) { counter++; for(int j=0;j<1024;j++) { boolean bit = input.nextBoolean(); } System.out.println(counter); }
Or is ther anyway where I can count the number of binaries in a file?




Reply With Quote