### Question:
Base64 { public static String toBase64String(final byte[] data) { if (data == null) { return null; } try { return encodeBytes(data, NO_OPTIONS); } catch (IOException e) { e.printStackTrace(System.err); return null; } } private  Base64(); static String toBase64String(final byte[] data); static byte[] fromBase64String(final String encoded); static byte[] fromBase64(final byte[] pArray);  }### Answer:
@Test public void testTo() { byte[] foobarBytes = "foobar".getBytes(); assertEquals( "foobar should be encoded the same way as in commons-codec", new String(encodeBase64(foobarBytes, false), Constants.CHARSET), Base64.toBase64String(foobarBytes) ); }