class ShortUUID {

    public static String encode(String longUUID) {
        String uuidStr = longUUID.toString().replaceAll("-", "");

        Double factor = Math.log(25d) / Math.log(ALPHABET_LEN);
        Double length = Math.ceil(factor * 16);

        BigInteger number = new BigInteger(uuidStr, 16);

        return encode(number, ALPHABET, length.intValue());
    }

}