Base64 { public static String encode(byte[] input) { if (input.length == 0) { return ""; } byte[] encoded = java.util.Base64.getEncoder().encode(input); return new String(encoded, StandardCharsets.UTF_8); }  static String encode(byte[] input); static byte[] decode(String input);  }
@Test public void encode() { String encoded = Base64.encode(Numeric.hexStringToByteArray( "150c14242dbf5e2f6ac2568b59b7822278d571b75f17be0c14242dbf5e2f6ac2568b59b7822278d571b75f17be13c00c087472616e736665720c14897720d8cd76f4f00abfa37c0edd889c208fde9b41627d5b5238")); String expected = "FQwUJC2/Xi9qwlaLWbeCInjVcbdfF74MFCQtv14vasJWi1m3giJ41XG3Xxe" + "+E8AMCHRyYW5zZmVyDBSJdyDYzXb08Aq/o3wO3YicII/em0FifVtSOA=="; assertThat(encoded, is(expected)); }