Java tutorial
//package com.java2s; //License from project: Apache License import java.math.BigInteger; public class Main { final protected static String base58Array = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; public static byte[] base58ToBytes(String value) { BigInteger bigNum58 = new BigInteger("58"); BigInteger tempBigValue = new BigInteger("0"); int leadingZeroes = 0; boolean justStarted = true; for (int i = 0; i < value.length(); i++) { if (justStarted && value.toCharArray()[i] == '1') { leadingZeroes++; } else { justStarted = false; tempBigValue = tempBigValue.add(bigNum58.pow(value.length() - i - 1) .multiply(new BigInteger("" + base58Array.indexOf(value.toCharArray()[i])))); } } byte[] bigValue = tempBigValue.toByteArray(); int bigValueStart = 0; for (int j = 0; j < bigValue.length; j++) { if (bigValue[j] != 0) { bigValueStart = j; break; } } byte[] byteResult = new byte[bigValue.length + leadingZeroes - bigValueStart]; for (int i = 0; i < byteResult.length; i++) { if (i - leadingZeroes + bigValueStart < bigValue.length && i - leadingZeroes + bigValueStart >= 0) byteResult[i] = i < leadingZeroes ? 0 : bigValue[i - leadingZeroes + bigValueStart]; } return byteResult; } }