public class Tool4Number
extends java.lang.Object
Tool4Number
class provides methods for number computing.Constructor and Description |
---|
Tool4Number()
The constructor
Tool4Number creates a new instance(object) of the class. |
Modifier and Type | Method and Description |
---|---|
java.math.BigDecimal |
getBigDecimal(java.math.BigDecimal number)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(java.math.BigDecimal number,
int scale)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(double number)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(double number,
int scale)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(long number)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(long number,
int scale)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(java.lang.String number)
The method
getBigDecimal create a BigDecimal. |
java.math.BigDecimal |
getBigDecimal(java.lang.String number,
int scale)
The method
getBigDecimal create a BigDecimal. |
int |
getByteArray2Int(byte[] data)
The method
getByteArray2Int converts a byte array to a integer. |
java.lang.Double |
getDouble(java.math.BigDecimal number)
The method
getDouble creates a Double. |
java.lang.Double |
getDouble(java.lang.String number)
The method
getDouble creates a Double. |
byte[] |
getInt2ByteArray(int number)
The method
getInt2ByteArray converts an integer number to a byte array. |
short |
getInt2Short(int number)
The method
getLong2Int converts a int number to a short number. |
int |
getLong2Int(long number)
The method
getLong2Int converts a long number to an int number. |
java.lang.String |
getNumber2String(java.math.BigDecimal number,
java.util.Locale localedef)
The method
getNumber2String converts a number into formated. |
java.lang.String |
getNumber2String(double number,
int digits,
java.util.Locale localedef)
The method
getNumber2String converts a number into formated. |
java.lang.String |
getNumber2String(double number,
int digits,
java.util.Locale localedef,
boolean thousand_points)
The method
getNumber2String converts a number into formated. |
java.lang.String |
getNumber2String(double number,
java.util.Locale localedef)
The method
getNumber2String converts a number into formated. |
java.lang.String |
getNumber2String(long number,
int size,
java.util.Locale localedef)
The method
getNumber2String converts a number into formated with leadin zeroes. |
java.lang.String |
getNumber2String(long number,
java.util.Locale localedef)
The method
getNumber2String converts a number into formated. |
java.lang.String |
getNumber2String(long number,
java.util.Locale localedef,
boolean thousand_points)
The method
getNumber2String converts a number into formated. |
java.lang.String |
getNumber2StringScience(double number,
java.util.Locale localedef)
The method
getNumber2StringScience converts a number into the science formated. |
double |
getRandAsDouble()
The method
getRandAsDouble creates a double random number. |
int |
getRandAsInt(int max)
The method
getRandAsInt creates a integer random number between 0 and max. |
java.math.BigDecimal |
getString2BigDecimal(java.lang.String number,
int scale,
java.util.Locale localedef)
The method
getString2BigDecimal converts a string into a BigDecimal. |
java.math.BigDecimal |
getString2BigDecimal(java.lang.String number,
java.util.Locale localedef)
The method
getString2BigDecimal converts a string into a BigDecimal. |
double |
getString2Double(java.lang.String number,
java.util.Locale localedef)
The method
getString2Double converts a string into a double. |
float |
getString2Float(java.lang.String number,
java.util.Locale localedef)
The method
getString2Float converts a string into a float. |
int |
getString2Int(java.lang.String number,
java.util.Locale localedef)
The method
getString2Long converts a string into a int. |
long |
getString2Long(java.lang.String number,
java.util.Locale localedef)
The method
getString2Long converts a string into a long. |
java.lang.String |
getValideNumberString(java.lang.String number,
java.lang.String type)
The method
getValideNumberString creates a string. |
boolean |
isLongNumber(java.lang.String number)
The method
isLongNumber checks a given string if it is a numeric string of type long. |
boolean |
isNumber(java.lang.String number)
The method
isNumber checks a given string if it is a numeric string. |
public Tool4Number()
Tool4Number
creates a new instance(object) of the class.public int getLong2Int(long number) throws java.lang.Exception
getLong2Int
converts a long number to an int number.number
- as long.java.lang.Exception
- if errorpublic short getInt2Short(int number) throws java.lang.Exception
getLong2Int
converts a int number to a short number.number
- as int.java.lang.Exception
- if errorpublic byte[] getInt2ByteArray(int number) throws java.lang.Exception
getInt2ByteArray
converts an integer number to a byte array.number
- as int.java.lang.Exception
- if errorpublic int getByteArray2Int(byte[] data) throws java.lang.Exception
getByteArray2Int
converts a byte array to a integer.data
- the byte array.java.lang.Exception
- if errorpublic java.math.BigDecimal getBigDecimal(java.lang.String number)
getBigDecimal
create a BigDecimal.number
- as string.public java.math.BigDecimal getBigDecimal(java.lang.String number, int scale)
getBigDecimal
create a BigDecimal.number
- as string.scale
- the scale.public java.math.BigDecimal getBigDecimal(double number)
getBigDecimal
create a BigDecimal.number
- as double.public java.math.BigDecimal getBigDecimal(double number, int scale)
getBigDecimal
create a BigDecimal.number
- as double.scale
- the scale.public java.math.BigDecimal getBigDecimal(long number)
getBigDecimal
create a BigDecimal.number
- as long.public java.math.BigDecimal getBigDecimal(long number, int scale)
getBigDecimal
create a BigDecimal.number
- as long.scale
- the scale.public java.math.BigDecimal getBigDecimal(java.math.BigDecimal number)
getBigDecimal
create a BigDecimal.number
- as BigDecimal.public java.math.BigDecimal getBigDecimal(java.math.BigDecimal number, int scale)
getBigDecimal
create a BigDecimal.number
- as BigDecimal.scale
- the scale.public java.lang.Double getDouble(java.math.BigDecimal number)
getDouble
creates a Double.number
- as BigDecimal.public java.lang.Double getDouble(java.lang.String number)
getDouble
creates a Double.number
- as String.public java.math.BigDecimal getString2BigDecimal(java.lang.String number, int scale, java.util.Locale localedef) throws java.lang.Exception
getString2BigDecimal
converts a string into a BigDecimal.number
- as string.scale
- the scale.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.math.BigDecimal getString2BigDecimal(java.lang.String number, java.util.Locale localedef) throws java.lang.Exception
getString2BigDecimal
converts a string into a BigDecimal.number
- as string.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic double getString2Double(java.lang.String number, java.util.Locale localedef) throws java.lang.Exception
getString2Double
converts a string into a double.number
- as string.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic float getString2Float(java.lang.String number, java.util.Locale localedef) throws java.lang.Exception
getString2Float
converts a string into a float.number
- as string.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic long getString2Long(java.lang.String number, java.util.Locale localedef) throws java.lang.Exception
getString2Long
converts a string into a long.number
- as string.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic int getString2Int(java.lang.String number, java.util.Locale localedef) throws java.lang.Exception
getString2Long
converts a string into a int.number
- as string.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(java.math.BigDecimal number, java.util.Locale localedef) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as BigDecimal.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(double number, java.util.Locale localedef) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as double.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(double number, int digits, java.util.Locale localedef) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as double.digits
- digits after decimal point.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getNumber2StringScience(double number, java.util.Locale localedef) throws java.lang.Exception
getNumber2StringScience
converts a number into the science formated.number
- as double.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(double number, int digits, java.util.Locale localedef, boolean thousand_points) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as double.digits
- digits after decimal point.localedef
- the locale for format definition.thousand_points
- make thousand points.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(long number, java.util.Locale localedef) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as long.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(long number, java.util.Locale localedef, boolean thousand_points) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as long.localedef
- the locale for format definition.thousand_points
- true: with thousand points.java.lang.Exception
- if errorpublic java.lang.String getNumber2String(long number, int size, java.util.Locale localedef) throws java.lang.Exception
getNumber2String
converts a number into formated with leadin zeroes.number
- as long.size
- is the length of the string.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic java.lang.String getValideNumberString(java.lang.String number, java.lang.String type) throws java.lang.Exception
getValideNumberString
creates a string.
of a given numer string without characters with are not digits.number
- as string.type
- of number.java.lang.Exception
- if errorpublic boolean isLongNumber(java.lang.String number)
isLongNumber
checks a given string if it is a numeric string of type long.number
- as string.public boolean isNumber(java.lang.String number)
isNumber
checks a given string if it is a numeric string.number
- as string.public int getRandAsInt(int max)
getRandAsInt
creates a integer random number between 0 and max.max
- as int.public double getRandAsDouble()
getRandAsDouble
creates a double random number.