NumberUtils: isNumber(String arg0) : NumberUtils « org.apache.commons.math « Java by API






NumberUtils: isNumber(String arg0)

/*
Is Digits >>> false
Is Number >>> true
MAX >>> 8.88

 */
import java.math.BigDecimal;

import org.apache.commons.lang.math.NumberUtils;

public class MathUtilsTrial {
  public static void main(String[] args) {

    // Check if a String contains only digits
    System.out.println("Is Digits >>> " + NumberUtils.isDigits("123.123"));

    // Check if a String is a valid number
    System.out.println("Is Number >>> " + NumberUtils.isNumber("123.123"));

    // Get MAX value from an array
    System.out.println("MAX >>> " + NumberUtils.max(new double[] { 3.33, 8.88, 1.11 }));

  }
}

           
       








Apache-Common-Lang.zip( 248 k)

Related examples in the same category

1.NumberUtils: compare(double arg0, double arg1)
2.NumberUtils: createBigDecimal(String arg0)
3.NumberUtils: isDigits(String arg0)
4.NumberUtils.max(double[] df)