Java Checksum Calculate checkSum(byte value)

Here you can find the source of checkSum(byte value)

Description

check Sum

License

Open Source License

Declaration

public static byte checkSum(byte value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte checkSum(byte value) {
        return (byte) (value ^ (-1));
    }//  w  w  w .java2 s.  c om

    public static byte[] checkSum(byte[] data) {
        if (null == data) {
            throw new IllegalArgumentException("data should not be null");
        }

        byte[] checkSum = new byte[data.length];
        for (int i = 0; i < data.length; i++) {
            checkSum[i] = checkSum(data[i]);
        }
        return checkSum;
    }
}

Related

  1. calculateChecksum(InputStream is, String algorithm)
  2. calculateChecksums(Optional zos, InputStream inputStream, Set checksumAlgorithms)
  3. checkSum(boolean[] a)
  4. checkSum(byte abyte0[])
  5. checksum(byte current, final byte[] data, final int offset, final int length)
  6. checkSum(byte[] b, int offset, int length)
  7. checksum(byte[] buf, int off, int len)
  8. checksum(byte[] data)
  9. checksum(byte[] message, int offset, int count)