org.apache.commons.lang
クラス NumberUtils

java.lang.Object
  拡張org.apache.commons.lang.NumberUtils

推奨されていません。 org.apache.commons.lang.math に移動しました。 このクラスは Commons Lang 3.0 では削除されます。
Moved to org.apache.commons.lang.math. Class will be removed in Commons Lang 3.0.

public final class NumberUtils
extends Object

Provides extra functionality for Java Number classes.

導入されたバージョン:
1.0
バージョン:
$Id: NumberUtils.java,v 1.1.1.1 2004/02/13 10:02:05 hioki Exp $
作成者:
Henri Yandell, Rand McNeely, Stephen Colebourne, Steve Downey, Eric Pugh, Phil Steitz
翻訳状況:
見送り

コンストラクタの概要
NumberUtils()
          推奨されていません。 NumberUtils instances should NOT be constructed in standard programming.
 
メソッドの概要
static int compare(double lhs, double rhs)
          推奨されていません。 Compares two doubles for order.
static int compare(float lhs, float rhs)
          推奨されていません。 Compares two floats for order.
static BigDecimal createBigDecimal(String val)
          推奨されていません。 Convert a String to a BigDecimal.
static BigInteger createBigInteger(String val)
          推奨されていません。 Convert a String to a BigInteger.
static Double createDouble(String val)
          推奨されていません。 Convert a String to a Double.
static Float createFloat(String val)
          推奨されていません。 Convert a String to a Float.
static Integer createInteger(String val)
          推奨されていません。 Convert a String to a Integer, handling hex and octal notations.
static Long createLong(String val)
          推奨されていません。 Convert a String to a Long.
static Number createNumber(String val)
          推奨されていません。 Turns a string value into a java.lang.Number.
static boolean isDigits(String str)
          推奨されていません。 Checks whether the String contains only digit characters.
static boolean isNumber(String str)
          推奨されていません。 Checks whether the String a valid Java number.
static int maximum(int a, int b, int c)
          推奨されていません。 Gets the maximum of three int values.
static long maximum(long a, long b, long c)
          推奨されていません。 Gets the maximum of three long values.
static int minimum(int a, int b, int c)
          推奨されていません。 Gets the minimum of three int values.
static long minimum(long a, long b, long c)
          推奨されていません。 Gets the minimum of three long values.
static int stringToInt(String str)
          推奨されていません。 Convert a String to an int, returning zero if the conversion fails.
static int stringToInt(String str, int defaultValue)
          推奨されていません。 Convert a String to an int, returning a default value if the conversion fails.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

NumberUtils

public NumberUtils()
推奨されていません。 

NumberUtils instances should NOT be constructed in standard programming. Instead, the class should be used as NumberUtils.stringToInt("6");.

This constructor is public to permit tools that require a JavaBean instance to operate.

メソッドの詳細

stringToInt

public static int stringToInt(String str)
推奨されていません。 

Convert a String to an int, returning zero if the conversion fails.

パラメータ:
str - the string to convert
戻り値:
the int represented by the string, or zero if conversion fails

stringToInt

public static int stringToInt(String str,
                              int defaultValue)
推奨されていません。 

Convert a String to an int, returning a default value if the conversion fails.

パラメータ:
str - the string to convert
defaultValue - the default value
戻り値:
the int represented by the string, or the default if conversion fails

createNumber

public static Number createNumber(String val)
                           throws NumberFormatException
推奨されていません。 

Turns a string value into a java.lang.Number.

First, the value is examined for a type qualifier on the end ('f','F','d','D','l','L'). If it is found, it starts trying to create succissively larger types from the type specified until one is found that can hold the value.

If a type specifier is not found, it will check for a decimal point and then try successively larger types from Integer to BigInteger and from Float to BigDecimal.

If the string starts with 0x or -0x, it will be interpreted as a hexadecimal integer. Values with leading 0's will not be interpreted as octal.

パラメータ:
val - String containing a number
戻り値:
Number created from the string
例外:
NumberFormatException - if the value cannot be converted

createFloat

public static Float createFloat(String val)
推奨されていません。 

Convert a String to a Float.

パラメータ:
val - a String to convert
戻り値:
converted Float
例外:
NumberFormatException - if the value cannot be converted

createDouble

public static Double createDouble(String val)
推奨されていません。 

Convert a String to a Double.

パラメータ:
val - a String to convert
戻り値:
converted Double
例外:
NumberFormatException - if the value cannot be converted

createInteger

public static Integer createInteger(String val)
推奨されていません。 

Convert a String to a Integer, handling hex and octal notations.

パラメータ:
val - a String to convert
戻り値:
converted Integer
例外:
NumberFormatException - if the value cannot be converted

createLong

public static Long createLong(String val)
推奨されていません。 

Convert a String to a Long.

パラメータ:
val - a String to convert
戻り値:
converted Long
例外:
NumberFormatException - if the value cannot be converted

createBigInteger

public static BigInteger createBigInteger(String val)
推奨されていません。 

Convert a String to a BigInteger.

パラメータ:
val - a String to convert
戻り値:
converted BigInteger
例外:
NumberFormatException - if the value cannot be converted

createBigDecimal

public static BigDecimal createBigDecimal(String val)
推奨されていません。 

Convert a String to a BigDecimal.

パラメータ:
val - a String to convert
戻り値:
converted BigDecimal
例外:
NumberFormatException - if the value cannot be converted

minimum

public static long minimum(long a,
                           long b,
                           long c)
推奨されていません。 

Gets the minimum of three long values.

パラメータ:
a - value 1
b - value 2
c - value 3
戻り値:
the smallest of the values

minimum

public static int minimum(int a,
                          int b,
                          int c)
推奨されていません。 

Gets the minimum of three int values.

パラメータ:
a - value 1
b - value 2
c - value 3
戻り値:
the smallest of the values

maximum

public static long maximum(long a,
                           long b,
                           long c)
推奨されていません。 

Gets the maximum of three long values.

パラメータ:
a - value 1
b - value 2
c - value 3
戻り値:
the largest of the values

maximum

public static int maximum(int a,
                          int b,
                          int c)
推奨されていません。 

Gets the maximum of three int values.

パラメータ:
a - value 1
b - value 2
c - value 3
戻り値:
the largest of the values

compare

public static int compare(double lhs,
                          double rhs)
推奨されていません。 

Compares two doubles for order.

This method is more comprehensive than the standard Java greater than, less than and equals operators.

The ordering is as follows, largest to smallest:

Comparing NaN with NaN will return 0.

パラメータ:
lhs - the first double
rhs - the second double
戻り値:
-1 if lhs is less, +1 if greater, 0 if equal to rhs

compare

public static int compare(float lhs,
                          float rhs)
推奨されていません。 

Compares two floats for order.

This method is more comprhensive than the standard Java greater than, less than and equals operators.

The ordering is as follows, largest to smallest:

Comparing NaN with NaN will return 0.

パラメータ:
lhs - the first float
rhs - the second float
戻り値:
-1 if lhs is less, +1 if greater, 0 if equal to rhs

isDigits

public static boolean isDigits(String str)
推奨されていません。 

Checks whether the String contains only digit characters.

Null and empty String will return false.

パラメータ:
str - the String to check
戻り値:
true if str contains only unicode numeric

isNumber

public static boolean isNumber(String str)
推奨されていません。 

Checks whether the String a valid Java number.

Valid numbers include hexadecimal marked with the 0x qualifier, scientific notation and numbers marked with a type qualifier (e.g. 123L).

Null and empty String will return false.

パラメータ:
str - the String to check
戻り値:
true if the string is a correctly formatted number


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation