ULongByteUtils { static byte[] fromLong(final long value, final int numBytes) { long leftedValue = value; byte[] res = new byte[numBytes]; for(int i = 0; i < numBytes; i++) { res[i] = (byte) (leftedValue & BYTE_MASK); leftedValue = leftedValue >> 8; } return res; } private  ULongByteUtils();   }
@Test public void getUIntSize2ShouldWorkFor0() { assertArrayEquals("Long(2) : 0 => 0", new byte[]{0, 0}, ULongByteUtils.fromLong(0, 2)); }
@Test public void getUIntSize2ShouldWorkFor1() { assertArrayEquals("Long(2) : 1 => 1", new byte[]{1, 0}, ULongByteUtils.fromLong(1, 2)); }
@Test public void getUIntSize2ShouldWorkForMaxValue() { assertArrayEquals("Long(2) : 65535 => 65535", new byte[]{-1, -1}, ULongByteUtils.fromLong(65535, 2)); }
@Test public void getUIntSize2ShouldWorkFor30() { assertArrayEquals("Long(2) : 30 => 30", new byte[]{30, 0}, ULongByteUtils.fromLong(30, 2)); }