H { public static int crc8(byte[] b, int start, int len) { int crc = 0; for (int i = start; i < start + len; i++) { crc = (byte) H.CRC_TABLE[((byte) (crc) ^ b[i]) & 0xFF]; } return (crc & 0xFF); }  static String intToHex(int i); static int toInt(byte b); static int toInt(byte[] bytes); static long toLong(byte[] bytes); static String bytesToHex(byte[] bytes); static byte[] reverse4bytes(byte[] b); static byte[] reverse8bytes(byte[] b); static byte[] toReversedBytes(short s); static byte[] toBytes(int i); static byte[] toReversedBytes(int i); static byte[] toBytes(long i); static String getDateFromMs(String ms); static String getDateFromSeconds(String seconds); static byte[] hexStringToByteArray(String s); static int crc8(byte[] b, int start, int len); static float round(float d, int decimalPlace); static double calculationByDistance(LatLng StartP, LatLng EndP); static byte[] concatArray(byte[] a, byte[] b); static String k(String s); static byte[] floatToByteArrayRev(float value); static byte[] floatToByteArray(float value); static float stringToFloat(String s); static String getLogFilename(); static String trunc(@NonNull final String s, final int l); static int dpToPx(int dp, @NonNull Context c); static Bitmap drawableToBitmap(int imgRes, int dpwidth, int dpheight, @NonNull Context c); static Bitmap drawableToBitmap(Drawable d, int dpwidth, int dpheight, @NonNull Context c); final static String NS; final static String RS; final static String S; }
@Test public void crc8_LoremIpsum_ReturnsChecksum() { final int RESULT = 0x3a; final byte[] TEST_BYTE_ARRAY = LOREMIPSUM.getBytes(); assertThat(H.crc8(TEST_BYTE_ARRAY, 0, TEST_BYTE_ARRAY.length), equalTo(RESULT)); }