### Question:
Base58 { public static byte[] decode(String input) throws AddressFormatException { if (input.length() == 0) { return new byte[0]; } byte[] input58 = new byte[input.length()]; for (int i = 0; i < input.length(); ++i) { char c = input.charAt(i); int digit58 = -1; if (c >= 0 && c < 128) { digit58 = INDEXES[c]; } if (digit58 < 0) { throw new AddressFormatException("Illegal character " + c + " at " + i); } input58[i] = (byte) digit58; } int zeroCount = 0; while (zeroCount < input58.length && input58[zeroCount] == 0) { ++zeroCount; } byte[] temp = new byte[input.length()]; int j = temp.length; int startAt = zeroCount; while (startAt < input58.length) { byte mod = divmod256(input58, startAt); if (input58[startAt] == 0) { ++startAt; } temp[--j] = mod; } while (j < temp.length && temp[j] == 0) { ++j; } return copyOfRange(temp, j - zeroCount, temp.length); }  static String encode(byte[] input); static byte[] decode(String input); static BigInteger decodeToBigInteger(String input); static byte[] decodeChecked(String input); static final char[] ALPHABET; }### Answer:
@Test public void testDecode() throws Exception { byte[] testbytes = "Hello World".getBytes(); byte[] actualbytes = Base58.decode("JxF12TrwUP45BMd"); assertTrue(new String(actualbytes), Arrays.equals(testbytes, actualbytes)); assertTrue("1", Arrays.equals(Base58.decode("1"), new byte[1])); assertTrue("1111", Arrays.equals(Base58.decode("1111"), new byte[4])); try { Base58.decode("This isn't valid base58"); fail(); } catch (AddressFormatException e) { } Base58.decodeChecked("4stwEBjT6FYyVV"); try { Base58.decodeChecked("4stwEBjT6FYyVW"); fail(); } catch (AddressFormatException e) { } try { Base58.decodeChecked("4s"); fail(); } catch (AddressFormatException e) { } assertEquals(0, Base58.decode("").length); Base58.decodeChecked("93VYUMzRG9DdbRP72uQXjaWibbQwygnvaCu9DumcqDjGybD864T"); }