|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ejie.r01f.util.NumberUtils
Contiene utilidades matemáticas.
Field Summary | |
static int |
INTEGER_WIDTH
El tamaño estandar para enteros de java |
Constructor Summary | |
NumberUtils()
|
Method Summary | |
static int |
bytesToInt(byte[] byteArray)
Convierte un array de bytes en un entero NOTA: Devuelve el LSB (LessSignificantByte) en [0] |
static int |
clearBit(int originalInt,
int bitIndex)
Borra un bit de un entero y devuelve este nuevo entero |
static boolean |
getBit(int integer,
int bitIndex)
Devuelve el valor de un bit de un entero |
static byte[] |
intToBytes(int integer)
Convierte un entero en un array de bytes NOTA: Devuelve el LSB (LessSignificantByte) en [0] |
static boolean |
isByte(java.lang.String strByte)
Comprueba si una cadena es un byte |
static boolean |
isByte(java.lang.String strByte,
int radix)
Comprueba si una cadena es un byte |
static boolean |
isDouble(java.lang.String strDouble)
Comprueba si una cadena es un Double |
static boolean |
isEven(int intNum)
Comprueba si un entero es par. |
static boolean |
isEven(long longNum)
Comprueba si un long es par. |
static boolean |
isFloat(java.lang.String strFloat)
Comprueba si una cadena es un Float |
static boolean |
isInteger(java.lang.String strInt)
Comprueba si una cadena es un entero |
static boolean |
isInteger(java.lang.String strInt,
int radix)
Comprueba si una cadena es un entero |
static boolean |
isLong(java.lang.String strLong)
Comprueba si una cadena es un Long |
static boolean |
isLong(java.lang.String strLong,
int radix)
Comprueba si una cadena es un Long |
static boolean |
isNumber(java.lang.String s)
Valida si una cadena es un número |
static boolean |
isOdd(int intNum)
Comprueba si un entero es impar. |
static boolean |
isOdd(long longNum)
Comprueba si un long es impar. |
static boolean |
isShort(java.lang.String strShort)
Comprueba si una cadena es un Short |
static void |
main(java.lang.String[] args)
Main Method |
static int |
setBit(int originalInt,
int bitIndex)
Establece un bit de un entero y devuelve este nuevo entero |
static byte |
toByte(double d)
double to byte |
static byte |
toByte(float f)
float to byte |
static byte |
toByte(int i)
int to byte |
static byte |
toByte(long l)
long to byte |
static byte |
toByte(short sh)
short to byte |
static byte |
toByte(java.lang.String s)
String to byte |
static double |
toDouble(byte b)
byte to double |
static double |
toDouble(float f)
float to double |
static double |
toDouble(int i)
int to double |
static double |
toDouble(long l)
long to double |
static double |
toDouble(short s)
short to double |
static double |
toDouble(java.lang.String s)
String to double |
static float |
toFloat(byte b)
byte to float |
static float |
toFloat(double d)
double to float |
static float |
toFloat(int i)
int to float |
static float |
toFloat(long l)
long to float |
static float |
toFloat(short sh)
short to float |
static float |
toFloat(java.lang.String s)
String to float |
static int |
toInt(byte b)
byte to int |
static int |
toInt(double d)
double to int |
static int |
toInt(float f)
float to int |
static int |
toInt(long l)
long to int |
static int |
toInt(short sh)
short to int |
static int |
toInt(java.lang.String s)
String to int |
static long |
toLong(byte b)
byte to Long |
static long |
toLong(double d)
double to Long |
static long |
toLong(float f)
float to Long |
static long |
toLong(int i)
int to Long |
static long |
toLong(short sh)
short to Long |
static long |
toLong(java.lang.String s)
String to Long |
static short |
toShort(byte b)
byte to Short |
static short |
toShort(double d)
double to Short |
static short |
toShort(float f)
float to Short |
static short |
toShort(int i)
int to Short |
static short |
toShort(long l)
long to Short |
static short |
toShort(java.lang.String s)
String to Short |
static java.lang.String |
toString(byte d)
byte to String |
static java.lang.String |
toString(double d)
double to String |
static java.lang.String |
toString(float f)
float to String |
static java.lang.String |
toString(int i)
int to String |
static java.lang.String |
toString(long l)
long to String |
static java.lang.String |
toString(short sh)
short to String |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INTEGER_WIDTH
Constructor Detail |
public NumberUtils()
Method Detail |
public static boolean isEven(int intNum)
public static boolean isOdd(int intNum)
intNum
- el entero
public static boolean isEven(long longNum)
public static boolean isOdd(long longNum)
longNum
- el long
public static int setBit(int originalInt, int bitIndex)
originalInt
- El entero en el que hay que establecer el bitbitIndex
- El indice del bit a establecer
public static int clearBit(int originalInt, int bitIndex)
originalInt
- el entero en el que hay que establecer el bitbitIndex
- El indice del bit a establecer
public static boolean getBit(int integer, int bitIndex)
integer
- el entero del cual hay que extraer un bitbitIndex
- el indice del bit a extraer
public static byte[] intToBytes(int integer)
integer
- El entero a convertir
public static int bytesToInt(byte[] byteArray)
byteArray
- El array de bytes que componen el entero con el LSB (LessSignificantByte) en [0]
public static byte toByte(double d)
public static byte toByte(float f)
public static byte toByte(int i)
public static byte toByte(long l)
public static byte toByte(short sh)
public static byte toByte(java.lang.String s)
public static double toDouble(byte b)
public static double toDouble(float f)
public static double toDouble(int i)
public static double toDouble(long l)
public static double toDouble(short s)
public static double toDouble(java.lang.String s)
public static float toFloat(byte b)
public static float toFloat(double d)
public static float toFloat(int i)
public static float toFloat(long l)
public static float toFloat(short sh)
public static float toFloat(java.lang.String s)
public static int toInt(byte b)
public static int toInt(double d)
public static int toInt(float f)
public static int toInt(long l)
public static int toInt(short sh)
public static int toInt(java.lang.String s)
public static long toLong(byte b)
public static long toLong(double d)
public static long toLong(float f)
public static long toLong(int i)
public static long toLong(short sh)
public static long toLong(java.lang.String s)
public static short toShort(byte b)
public static short toShort(double d)
public static short toShort(float f)
public static short toShort(int i)
public static short toShort(long l)
public static short toShort(java.lang.String s)
public static java.lang.String toString(byte d)
public static java.lang.String toString(double d)
public static java.lang.String toString(float f)
public static java.lang.String toString(int i)
public static java.lang.String toString(long l)
public static java.lang.String toString(short sh)
public static boolean isNumber(java.lang.String s)
s
- cadena a validar
public static boolean isInteger(java.lang.String strInt, int radix)
strInt
- La representacion del entero en forma de cadenaradix
- El formato de de la cadena de entrada: 2 binario, 8 octal, 10 decimal, 16 hex
public static boolean isInteger(java.lang.String strInt)
strInt
- La representacion DECIMAL del entero en forma de cadena
public static boolean isByte(java.lang.String strByte, int radix)
strByte
- La representacion del byte en forma de cadenaradix
- El formato de de la cadena de entrada: 2 binario, 8 octal, 10 decimal, 16 hex
public static boolean isByte(java.lang.String strByte)
strByte
- La representacion DECIMAL del byte en forma de cadena
public static boolean isLong(java.lang.String strLong, int radix)
strLong
- La representacion del long en forma de cadenaradix
- El formato de de la cadena de entrada: 2 binario, 8 octal, 10 decimal, 16 hex
public static boolean isLong(java.lang.String strLong)
strLong
- La representacion DECIMAL del long en forma de cadena
public static boolean isFloat(java.lang.String strFloat)
strFloat
- La representacion decimal del float en forma de cadena
public static boolean isShort(java.lang.String strShort)
strShort
- La representacion decimal del short en forma de cadena
public static boolean isDouble(java.lang.String strDouble)
strDouble
- La representacion del double en forma de cadena
public static void main(java.lang.String[] args)
args
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |