### Question:
BigendianEncoding { static long longFromByteArray(byte[] bytes, int offset) { Utils.checkArgument(bytes.length >= offset + LONG_BYTES, "array too small"); return (bytes[offset] & 0xFFL) << 56 | (bytes[offset + 1] & 0xFFL) << 48 | (bytes[offset + 2] & 0xFFL) << 40 | (bytes[offset + 3] & 0xFFL) << 32 | (bytes[offset + 4] & 0xFFL) << 24 | (bytes[offset + 5] & 0xFFL) << 16 | (bytes[offset + 6] & 0xFFL) << 8 | (bytes[offset + 7] & 0xFFL); } private  BigendianEncoding();   }### Answer:
@Test void longFromByteArray_ArrayToSmall() { assertThrows( IllegalArgumentException.class, () -> BigendianEncoding.longFromByteArray(new byte[LONG_BYTES], 1), "array too small"); }
@Test void longFromByteArray() { assertThat(BigendianEncoding.longFromByteArray(FIRST_BYTE_ARRAY, 0)).isEqualTo(FIRST_LONG); assertThat(BigendianEncoding.longFromByteArray(SECOND_BYTE_ARRAY, 0)).isEqualTo(SECOND_LONG); assertThat(BigendianEncoding.longFromByteArray(BOTH_BYTE_ARRAY, 0)).isEqualTo(FIRST_LONG); assertThat(BigendianEncoding.longFromByteArray(BOTH_BYTE_ARRAY, BigendianEncoding.LONG_BYTES)) .isEqualTo(SECOND_LONG); }
@Test public void longFromByteArray_ArrayToSmall() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("array too small"); BigendianEncoding.longFromByteArray(new byte[BigendianEncoding.LONG_BYTES], 1); }
@Test public void longFromByteArray() { assertThat(BigendianEncoding.longFromByteArray(FIRST_BYTE_ARRAY, 0)).isEqualTo(FIRST_LONG); assertThat(BigendianEncoding.longFromByteArray(SECOND_BYTE_ARRAY, 0)).isEqualTo(SECOND_LONG); assertThat(BigendianEncoding.longFromByteArray(BOTH_BYTE_ARRAY, 0)).isEqualTo(FIRST_LONG); assertThat(BigendianEncoding.longFromByteArray(BOTH_BYTE_ARRAY, BigendianEncoding.LONG_BYTES)) .isEqualTo(SECOND_LONG); }