### Question:
IntelHexRecord { private static int checksum(int recordLength, int loadOffset, int recordType, byte[] data) { int accum = 0; accum += recordLength & 0xff; accum += loadOffset & 0xff; accum += (loadOffset >> 8) & 0xff; accum += recordType & 0xff; for (int ii = 0; ii < data.length; ++ii) { final int t = data[ii] & 0xff; accum += t; } final int lowest = accum & 0xff; final int chk = (0x100 - lowest) & 0xff; return chk; } IntelHexRecord(int recordLength, int loadOffset, int recordType, byte[] data,
			int checksum);  IntelHexRecord(int recordLength, int loadOffset, int recordType, byte[] data); int getRecordLength(); int getLoadOffset(); int getRecordType(); byte[] getData(); String getDataString(); int getReportedChecksum(); int getActualChecksum(); boolean isReportedChecksumCorrect(); String format(); @Override int hashCode(); @Override boolean equals(Object obj); static final int MAX_RECORD_LENGTH; static final int DATA_RECORD_TYPE; static final int END_OF_FILE_RECORD_TYPE; static final int EXTENDED_SEGMENT_ADDRESS_RECORD_TYPE; static final int START_SEGMENT_ADDRESS_RECORD; static final int EXTENDED_LINEAR_ADDRESS_RECORD_TYPE; static final int START_LINEAR_ADDRESS_RECORD_TYPE; }### Answer:
@Test public void testChecksum() throws Exception { IntelHexRecord record = new IntelHexRecord(1, 0, 0, new byte[] { 4 }, 37); assertTrue("incorrect", !record.isReportedChecksumCorrect()); record = new IntelHexRecord(3, 0x0030, 0, new byte[] { 0x02, 0x33, 0x7a }, 0x1e); assertTrue("correct", record.isReportedChecksumCorrect()); }