### Question:
BytesUtils { public static long readLong(InputStream in) throws IOException { byte[] b = safeReadInputStreamToBytes(8, in); return BytesUtils.bytesToLong(b); }  static byte[] intToBytes(int i); static byte[] intToBytes(int i, byte[] desc, int offset); static void intToBytes(int srcNum, byte[] result, int pos, int width); static byte[] intToTwoBytes(int i); static int twoBytesToInt(byte[] ret); static int bytesToInt(byte[] bytes); static int bytesToInt(byte[] bytes, int offset); static int bytesToInt(byte[] result, int pos, int width); static byte[] floatToBytes(float x); static void floatToBytes(float x, byte[] desc, int offset); static float bytesToFloat(byte[] b); static float bytesToFloat(byte[] b, int offset); static byte[] doubleToBytes(double data); static void doubleToBytes(double d, byte[] bytes, int offset); static double bytesToDouble(byte[] bytes); static double bytesToDouble(byte[] bytes, int offset); static byte[] boolToBytes(boolean x); static byte[] boolToBytes(boolean x, byte[] desc, int offset); static boolean bytesToBool(byte[] b); static boolean bytesToBool(byte[] b, int offset); static byte[] longToBytes(long num); static byte[] longToBytes(long num, int len); static byte[] longToBytes(long num, byte[] desc, int offset); static void longToBytes(long srcNum, byte[] result, int pos, int width); static long bytesToLong(byte[] byteNum); static long bytesToLong(byte[] byteNum, int len); static long bytesToLong(byte[] result, int pos, int width); static long bytesToLongFromOffset(byte[] byteNum, int len, int offset); static byte[] stringToBytes(String str); static String bytesToString(byte[] byteStr); static byte[] concatByteArray(byte[] a, byte[] b); static byte[] concatByteArrayList(List<byte[]> list); static byte[] subBytes(byte[] src, int start, int length); static int getIntN(int data, int offset); static int setIntN(int data, int offset, int value); static int getByteN(byte data, int offset); static byte setByteN(byte data, int offset, int value); static int getLongN(long data, int offset); static long setLongN(long data, int offset, int value); static double readDouble(InputStream in); static float readFloat(InputStream in); static boolean readBool(InputStream in); static int readInt(InputStream in); static long readLong(InputStream in); static byte[] safeReadInputStreamToBytes(int count, InputStream in); static byte[] shortToBytes(short number); static short bytesToShort(byte[] b);  }### Answer:
@Test public void readLongTest() throws IOException { long l = 32143422454243342L; byte[] bs = BytesUtils.longToBytes(l); InputStream in = new ByteArrayInputStream(bs); assertEquals(l, BytesUtils.readLong(in)); }
@Test public void testReadLong() throws IOException { long l = r.nextLong(); byte[] bs = BytesUtils.longToBytes(l); InputStream in = new ByteArrayInputStream(bs); assertEquals(l, BytesUtils.readLong(in)); }