@Test public void byteBuffer2byteArrayTest() { String s = "yuzhouwan.com"; byte[] bytes = s.getBytes(); ByteBuffer bb = ByteBuffer.allocate(bytes.length); bb.put(bytes); assertEquals(s, new String(DecimalUtils.byteBuffer2byteArray(bb))); assertEquals(s, new String(DecimalUtils.byteBuffer2byteArray( DecimalUtils.byteArray2byteBuffer(bytes)))); }
public static byte[] byteBuffer2byteArray(ByteBuffer bb) { bb.clear(); byte[] ba = new byte[bb.remaining()]; bb.get(ba, 0, ba.length); return ba; }
DecimalUtils { public static byte[] byteBuffer2byteArray(ByteBuffer bb) { bb.clear(); byte[] ba = new byte[bb.remaining()]; bb.get(ba, 0, ba.length); return ba; } }
DecimalUtils { public static byte[] byteBuffer2byteArray(ByteBuffer bb) { bb.clear(); byte[] ba = new byte[bb.remaining()]; bb.get(ba, 0, ba.length); return ba; } private  DecimalUtils(); }
DecimalUtils { public static byte[] byteBuffer2byteArray(ByteBuffer bb) { bb.clear(); byte[] ba = new byte[bb.remaining()]; bb.get(ba, 0, ba.length); return ba; } private  DecimalUtils(); static int convert2Hex(int n); static BigInteger double2BigInt(double d); static String saveTwoPoint(double d); static String savePoint(double d, int point); static byte[] byteBuffer2byteArray(ByteBuffer bb); static ByteBuffer byteArray2byteBuffer(byte[] ba); }
DecimalUtils { public static byte[] byteBuffer2byteArray(ByteBuffer bb) { bb.clear(); byte[] ba = new byte[bb.remaining()]; bb.get(ba, 0, ba.length); return ba; } private  DecimalUtils(); static int convert2Hex(int n); static BigInteger double2BigInt(double d); static String saveTwoPoint(double d); static String savePoint(double d, int point); static byte[] byteBuffer2byteArray(ByteBuffer bb); static ByteBuffer byteArray2byteBuffer(byte[] ba);  }