0

I'm trying to implement a method , calculating the CRC and adding it to a input- bitstring . For this I have found the CRC32 class in Java. Since I'm not familiar with this subject, I'm not sure how i can add the CRC. The getValue() method of CRC32 would return a long type, but adding a long to a bitstring makes not much of sense.

public byte[] getData() {

      byte[] bytes = bits.toByteArray();
      return bytes ;


}

public void addCRC() {

    crc = new CRC32();
    crc.update(getData(), 0, getBitArrayLength());
    long crcLong = crc.getValue();


}
Grunwalski
  • 129
  • 5
  • Recently I have just wrote a network assignment for my network module that used CRC checksum. Anyway you may truncate the long to int. On top of that you may wanna make use of bytebuffer to manipulate the byte array. – Mox May 18 '15 at 16:30
  • how can i add an int to a bitstring. A bitSet is used to store the bits. Sorry if i sound a bit clueless, because i am clueless – Grunwalski May 18 '15 at 17:14

0 Answers0