Java tutorial
//package com.java2s; public class Main { public static <RET> RET fromBase36(String basecode) { Long result = Long.valueOf(basecode, 36); long maxInt = new Long(Integer.MAX_VALUE); if (result > maxInt) { return ((RET) result); } else { return ((RET) (Integer) result.intValue()); } } }