Package x3

Class CRC16

java.lang.Object
x3.CRC16

public class CRC16
extends java.lang.Object
Copied from Mark Johnson's CRC16v3 but adapted to work with a byte array rather than short input.
Author:
Doug Gillespie
  • Constructor Summary

    Constructors 
    Constructor Description
    CRC16()  
  • Method Summary

    Modifier and Type Method Description
    static short getCRC16​(byte[] byteBuffer, int nBytes)
    Generate a 16 bit crc code from byte data.
    static short getCRC16​(byte[] byteBuffer, int nBytes, int offsetBytes)
    Generate a 16 bit crc code from byte data.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getCRC16

      public static short getCRC16​(byte[] byteBuffer, int nBytes, int offsetBytes)
      Generate a 16 bit crc code from byte data.
      Parameters:
      byteBuffer - buffer of byte data
      nBytes - number of bytes to process
      offsetBytes - offset from start of byte buffer (in bytes).
      Returns:
      crc16 code.
    • getCRC16

      public static short getCRC16​(byte[] byteBuffer, int nBytes)
      Generate a 16 bit crc code from byte data.
      Parameters:
      byteBuffer - buffer of byte data
      nBytes - number of bytes to process
      offsetBytes - offset from start of byte buffer (in bytes).
      Returns:
      crc16 code.