@Test public void testValidateOspfCheckSum() throws Exception { assertThat(checksumCalculator.validateOspfCheckSum(helloPacket, ospfChecksumPos1, ospfChecksumPos2), is(true)); }
public boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2) { byte[] checkSum = calculateOspfCheckSum(ospfPacket, checksumPos1, checksumPos2); if (ospfPacket[checksumPos1] == checkSum[0] && ospfPacket[checksumPos2] == checkSum[1]) { return true; } return false; }
ChecksumCalculator { public boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2) { byte[] checkSum = calculateOspfCheckSum(ospfPacket, checksumPos1, checksumPos2); if (ospfPacket[checksumPos1] == checkSum[0] && ospfPacket[checksumPos2] == checkSum[1]) { return true; } return false; } }
ChecksumCalculator { public boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2) { byte[] checkSum = calculateOspfCheckSum(ospfPacket, checksumPos1, checksumPos2); if (ospfPacket[checksumPos1] == checkSum[0] && ospfPacket[checksumPos2] == checkSum[1]) { return true; } return false; }  }
ChecksumCalculator { public boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2) { byte[] checkSum = calculateOspfCheckSum(ospfPacket, checksumPos1, checksumPos2); if (ospfPacket[checksumPos1] == checkSum[0] && ospfPacket[checksumPos2] == checkSum[1]) { return true; } return false; }  static int convertToSixteenBits(String strToConvert); boolean isValidOspfCheckSum(OspfMessage ospfMessage, int checksumPos1, int checksumPos2); boolean isValidLsaCheckSum(OspfLsa ospfLsa, int lsType, int lsaChecksumPos1,
                                      int lsaChecksumPos2); boolean validateLsaCheckSum(byte[] lsaPacket, int lsaChecksumPos1, int lsaChecksumPos2); boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2); byte[] calculateLsaChecksum(byte[] lsaBytes, int lsaChecksumPos1, int lsaChecksumPos2); byte[] calculateOspfCheckSum(byte[] packet, int checksumPos1, int checksumPos2); }
ChecksumCalculator { public boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2) { byte[] checkSum = calculateOspfCheckSum(ospfPacket, checksumPos1, checksumPos2); if (ospfPacket[checksumPos1] == checkSum[0] && ospfPacket[checksumPos2] == checkSum[1]) { return true; } return false; }  static int convertToSixteenBits(String strToConvert); boolean isValidOspfCheckSum(OspfMessage ospfMessage, int checksumPos1, int checksumPos2); boolean isValidLsaCheckSum(OspfLsa ospfLsa, int lsType, int lsaChecksumPos1,
                                      int lsaChecksumPos2); boolean validateLsaCheckSum(byte[] lsaPacket, int lsaChecksumPos1, int lsaChecksumPos2); boolean validateOspfCheckSum(byte[] ospfPacket, int checksumPos1, int checksumPos2); byte[] calculateLsaChecksum(byte[] lsaBytes, int lsaChecksumPos1, int lsaChecksumPos2); byte[] calculateOspfCheckSum(byte[] packet, int checksumPos1, int checksumPos2);  }