Here you can find the source of parseNumber(String s)
public static Number parseNumber(String s)
//package com.java2s; /**//w ww . j a v a 2s .c o m * Mutinack mutation detection program. * Copyright (C) 2014-2016 Olivier Cinquin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.text.NumberFormat; import java.text.ParseException; public class Main { public static Number parseNumber(String s) { try { return NumberFormat.getInstance().parse(s); } catch (ParseException e) { throw new RuntimeException("Could not parse " + s + " to number", e); } } }