Java tutorial
import java.text.NumberFormat; import java.util.Locale; public class Main { public static void main(String[] argv) throws Exception { Number number = NumberFormat.getPercentInstance(Locale.CANADA).parse("123.45%"); // 1.2345 if (number instanceof Long) { System.out.println("Long value"); } else { System.out.println("Double value"); } } }