Sha256Utils { public static byte[] getBytes(CharSequence str) { try { return str.toString().getBytes("utf8"); } catch (final UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } }  static byte[] getBytes(CharSequence str); static byte[] digest(final byte[] raw); static byte[] digest(final byte[]... raws); static String mask(final CharSequence raw);  }
@Test public void testGetBytes() throws Exception { final String characterSequence = randomUUID().toString(); final byte[] expected = characterSequence.getBytes("utf-8"); assertTrue(Arrays.equals(expected, Sha256Utils.getBytes(characterSequence))); }