0
我认为它用randomAccessFile写入的顺序与它读取的顺序不匹配。我该如何纠正?这与Big/Little Endian有关吗?在Java中读写RandomAccessFile的命令
RandomAccessFile accessor = new RandomAccessFile (new File("passwd_file"), "rws");
accessor.write(macbytes);
//System.out.println(macbytes);
byte[] test=new byte[(int) accessor.length()];
accessor.seek(0);
accessor.read(test);
//System.out.println(test);
if (test.equals(macbytes))System.out.println("true");
else System.out.println("false");
http://stackoverflow.com/questions/8777257/equals-vs-arrays-equals-in-java – tkausl