import java.text.NumberFormat;
import java.util.Locale;
public class Main {
public static void main(String[] args) throws Exception {
Number number = NumberFormat.getNumberInstance(Locale.JAPAN).parse("25,000.75");
if (number instanceof Long) {
System.out.println("Long value: " + number.longValue());
} else if (number instanceof Double) {
System.out.println("Double value: " + number.doubleValue());
}
}
}
|