Java examples for java.nio:ByteBuffer
compare Binary ByteBuffer
//package com.java2s; import java.nio.ByteBuffer; import java.util.Arrays; public class Main { public static boolean compareBinary(ByteBuffer buf1, ByteBuffer buf2, int addr1, int addr2, int len) { byte[] b1 = new byte[len]; byte[] b2 = new byte[len]; buf1.position(addr1);/* w w w.j av a2s .c o m*/ buf2.position(addr2); buf1.get(b1); buf2.get(b2); return Arrays.equals(b1, b2); } }