### Question:
Base58 { public static String encode(byte[] input) { if (input.length == 0) { return ""; } int zeros = 0; while (zeros < input.length && input[zeros] == 0) { ++zeros; } input = Arrays.copyOf(input, input.length); char[] encoded = new char[input.length * 2]; int outputStart = encoded.length; for (int inputStart = zeros; inputStart < input.length; ) { encoded[--outputStart] = ALPHABET[divmod(input, inputStart, 256, 58)]; if (input[inputStart] == 0) { ++inputStart; } } while (outputStart < encoded.length && encoded[outputStart] == ENCODED_ZERO) { ++outputStart; } while (--zeros >= 0) { encoded[--outputStart] = ENCODED_ZERO; } return new String(encoded, outputStart, encoded.length - outputStart); }  static String encode(byte[] input); static String encodeChecked(int version, byte[] payload); static byte[] decode(String input); static BigInteger decodeToBigInteger(String input); static byte[] decodeChecked(String input); static final char[] ALPHABET; }### Answer:
@Test public void testEncode() throws Exception { byte[] testbytes = "Hello World".getBytes(); assertEquals("JxF12TrwUP45BMd", Base58.encode(testbytes)); BigInteger bi = BigInteger.valueOf(3471844090L); assertEquals("16Ho7Hs", Base58.encode(bi.toByteArray())); byte[] zeroBytes1 = new byte[1]; assertEquals("1", Base58.encode(zeroBytes1)); byte[] zeroBytes7 = new byte[7]; assertEquals("1111111", Base58.encode(zeroBytes7)); assertEquals("", Base58.encode(new byte[0])); }