-2

I want using CRC16, but first, i want to convert string to hex. because integer must be 16 bytes. i still confused to encrypt using CRC16. this is my code.

  public static void main(String[] args) {
            String input = "skn";
            byte[] valuesDefault = input.getBytes();
            System.out.println("input:" + input);
            System.out.println(Arrays.toString(valuesDefault));
}
  • 5
    Possible duplicate of [Converting A String To Hexadecimal In Java](https://stackoverflow.com/questions/923863/converting-a-string-to-hexadecimal-in-java) – Shashwat Mar 16 '18 at 03:58
  • @Shashwat no, the answer to that question is horrible, regardless of the upvotes. – Jim Garrison Mar 16 '18 at 04:34

1 Answers1

0

Try this below

DatatypeConverter.printHexBinary(input.getBytes())
Sasikumar Murugesan
  • 4,412
  • 10
  • 51
  • 74