public static void printHexByByteArray(String fileName)throws IOException{ FileInputStream in = new FileInputStream(fileName); byte[] buf = new byte[20*1024]; int bytes = in.read(buf, 0, buf.length); int j = 1; for(int i=0;i<bytes;i++){ if(buf[i]<=0xf){ System.out.print("0"); } System.out.print(Integer.toHexString(buf[i])+" "); if(j++%10==0){ System.out.println(); } } }
0ffffffca 0fffffffe 0ffffffba 0ffffffbe 00 00 00 34 00 34
知道了。。。没有&0xff。。。。