ch.elca.el4j.util.codingsupport
Class NumberUtils

java.lang.Object
  extended by ch.elca.el4j.util.codingsupport.NumberUtils

public final class NumberUtils
extends Object

This class supports methods to handle with numbers. It covers only caps of class org.springframework.util.NumberUtils.

Author:
Martin Zeltner (MZE)
File-location:
NumberUtils
Last check-in date:
2009-08-04 15:22:05 +0200 (Di, 04. Aug 2009) by swismer for revision 3881

Method Summary
static boolean isNumberInsideBoundaries(double value, double min, double max)
          Method to test if a given value is inside the given boundaries.
static boolean isNumberInsideBoundaries(int value, int min, int max)
          Method to test if a given value is inside the given boundaries.
static boolean isNumberInsideBoundaries(long value, long min, long max)
          Method to test if a given value is inside the given boundaries.
static Double parseToDouble(String s)
          Method to parse a string to a double.
static Integer parseToInteger(String s)
          Method to parse a string to an integer.
static Long parseToLong(String s)
          Method to parse a string to a long.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isNumberInsideBoundaries

public static boolean isNumberInsideBoundaries(int value,
                                               int min,
                                               int max)
Method to test if a given value is inside the given boundaries.

Parameters:
value - Is the given value to test.
min - Is the minimum that the value can be.
max - Is the maximum that the value can be.
Returns:
Returns true if value is greater or equals than minimum and is less or equals than maximum.

isNumberInsideBoundaries

public static boolean isNumberInsideBoundaries(long value,
                                               long min,
                                               long max)
Method to test if a given value is inside the given boundaries.

Parameters:
value - Is the given value to test.
min - Is the minimum that the value can be.
max - Is the maximum that the value can be.
Returns:
Returns true if value is greater or equals than minimum and is less or equals than maximum.

isNumberInsideBoundaries

public static boolean isNumberInsideBoundaries(double value,
                                               double min,
                                               double max)
Method to test if a given value is inside the given boundaries.

Parameters:
value - Is the given value to test.
min - Is the minimum that the value can be.
max - Is the maximum that the value can be.
Returns:
Returns true if value is greater or equals than minimum and is less or equals than maximum.

parseToInteger

public static Integer parseToInteger(String s)
Method to parse a string to an integer.

Parameters:
s - Is the string to parse.
Returns:
Return the Integer object if success else null.

parseToLong

public static Long parseToLong(String s)
Method to parse a string to a long.

Parameters:
s - Is the string to parse.
Returns:
Return the Long object if success else null.

parseToDouble

public static Double parseToDouble(String s)
Method to parse a string to a double.

Parameters:
s - Is the string to parse.
Returns:
Return the Double object if success else null.


Copyright © 2005-2011 ELCA. All Rights Reserved.