|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kalmeo.util.NumberUtil
public class NumberUtil
Field Summary | |
---|---|
static int |
ALL_FORMAT
|
static int |
KILO_BYTE
|
static int |
KILO_FORMAT
|
static int |
MEGA_BYTE
|
static int |
MEGA_FORMAT
|
Constructor Summary | |
---|---|
NumberUtil()
|
Method Summary | |
---|---|
static java.lang.String |
formatByte(int bytes,
int formsAllowed)
Format a bytes's count in string |
static java.lang.String |
formatFP(int fpValue,
int integerDigit,
int decimalDigit)
Format a fpValue with specified integer and decimal digits number |
static java.lang.String |
formatInt(int value,
int numDigit)
Format an integer value with specifie integer digits number |
static byte[] |
toBytes(int value)
Convert an int to a byte array |
static void |
toBytes(int value,
byte[] buffer,
int offset)
Convert an int to a byte array and set it into buffer
at specified offset |
static byte[] |
toBytes(long value)
Convert a long to a byte array |
static void |
toBytes(long value,
byte[] buffer,
int offset)
Convert a long to a byte array and set it into buffer
at specified offset |
static byte[] |
toBytes(short value)
Convert a short to a byte array |
static void |
toBytes(short value,
byte[] buffer,
int offset)
Convert a short to a byte array and set it into buffer
at specified offset |
static int |
toInt(byte[] bytes,
int offset)
Convert a byte array to an int value |
static long |
toLong(byte[] bytes,
int offset)
Convert a byte array to a long value |
static short |
toShort(byte[] bytes,
int offset)
Convert a byte array to a short value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MEGA_BYTE
public static final int KILO_BYTE
public static final int MEGA_FORMAT
public static final int KILO_FORMAT
public static final int ALL_FORMAT
Constructor Detail |
---|
public NumberUtil()
Method Detail |
---|
public static java.lang.String formatByte(int bytes, int formsAllowed)
bytes
- the bytes's countformsAllowed
- specifie wich form are autorized by the formater.
MEGA_FORMAT return bytes under MegaByte form, Byte else
KILO_FORMAT return bytes under KiloByte form, Byte else
ALL_FORMAT return bytes under MegaByte, KiloByte ot Byte form.
public static java.lang.String formatInt(int value, int numDigit)
value
- the value wich be formatednumDigit
- specifie the integer part size
public static java.lang.String formatFP(int fpValue, int integerDigit, int decimalDigit)
fpValue
- is the fixed point integer wich be formatedintegerDigit
- specifie the integer part sizedecimalDigit
- specifie the decimal part size
public static byte[] toBytes(short value)
value
-
public static byte[] toBytes(int value)
value
-
public static byte[] toBytes(long value)
value
-
public static void toBytes(short value, byte[] buffer, int offset)
buffer
at specified offset
value
- buffer
- offset
- public static void toBytes(int value, byte[] buffer, int offset)
buffer
at specified offset
value
- buffer
- offset
- public static void toBytes(long value, byte[] buffer, int offset)
buffer
at specified offset
value
- buffer
- offset
- public static short toShort(byte[] bytes, int offset)
bytes
- offset
-
public static int toInt(byte[] bytes, int offset)
bytes
- offset
-
public static long toLong(byte[] bytes, int offset)
bytes
- offset
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |