Here you can find the source of isNumeric(String str)
public static boolean isNumeric(String str)
//package com.java2s; /*/*from w w w . j a va 2 s .c o m*/ * BioAssay Ontology Annotator Tools * * (c) 2014-2016 Collaborative Drug Discovery Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License 2.0 * as published by the Free Software Foundation: * * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ import java.lang.reflect.*; import java.text.*; public class Main { /** * Returns true if the given string represents a parseable numeric value, either integer or floating point. */ public static boolean isNumeric(String str) { NumberFormat fmt = NumberFormat.getInstance(); ParsePosition pos = new ParsePosition(0); fmt.parse(str, pos); return str.length() == pos.getIndex(); } /** * Length of array, protected against nulls. */ public static int length(Object A) { return A == null ? 0 : Array.getLength(A); } }