|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.sys.Convert
Convert is used to convert between objects and basic types.
Field Summary | |
static CharacterConverter |
charConverter
The bytes are converted to char and vice-versa using the CharacterConverter associated in this charConverter member. |
static long |
MAX_LONG_VALUE
|
static long |
MIN_LONG_VALUE
|
Method Summary | |
static int |
chars2int(String fourChars)
Convert a creator id or a type to an int. |
static String[] |
cloneStringArray(String[] strs)
Creates a copy of the given array |
static int |
digitOf(char ch,
int radix)
returns the value of the digit in the specified radix. this method is simplified to only handle the standard ascii table. |
static long |
doubleToLongBits(double value)
Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout. |
static char |
forDigit(int digit,
int radix)
returns the digit in the corresponding radix. |
static String |
insertLineBreak(int maxWidth,
char separator,
FontMetrics fm,
String text)
This method is useful to insert line breaks into the text used in the MessageBox constructor. |
static double |
longBitsToDouble(long bits)
Returns the double-float corresponding to a given bit represention. |
static void |
qsort(Object[] items,
int first,
int last)
Applies the Quick Sort algorithm to the elements of the given array. |
static long |
rol(long i,
int n,
int bits)
Do a rol of n bits in the given i(nt). n must be < bits . |
static long |
ror(long i,
int n,
int bits)
Do a ror of n bits in the given i(nt). n must be < bits . |
static double |
toDouble(String s)
Converts the String to a double. |
static float |
toFloat(String s)
Converts the given String to a float. |
static float |
toFloatBitwise(int i)
Converts the given IEEE 754 bit representation of a float to a float. |
static int |
toInt(String s)
Converts the given String to an int. |
static int |
toIntBitwise(float f)
Converts the given float to its bit representation in IEEE 754 format. |
static String[] |
tokenizeString(String input,
char delim)
Tokenize the given input string. if there's no delim chars in input, returns the input string |
static long |
toLong(String s)
Converts the String to a long. |
static long |
toLong(String s,
int radix)
Converts the String to a long in the given radix. |
static char |
toLowerCase(char c)
converts the char to lower case letter |
static String |
toLowerCase(String s)
converts the string to lower case letters |
static String |
toString(boolean b)
Converts the given boolean to a String. |
static String |
toString(char c)
Converts the given char to a String. |
static String |
toString(double d)
Converts the given double to a String, formatting it using scientific notation. |
static String |
toString(double d,
int precision)
Converts the given double to a String, formatting it with |
static String |
toString(float f)
Converts the given float to a String. |
static String |
toString(float f,
int d)
Converts the given float to a String, formatting it with d decimal places. added by guich |
static String |
toString(int i)
Converts the given int to a String. |
static String |
toString(long l)
Converts the long to a String at base 10. |
static String |
toString(long i,
int radix)
Converts the long to a String in the given radix. |
static String |
toString(String doubleValue,
int n)
formats a String as a double, rounding with n decimal places. if the number is invalid, "0" is returned. |
static String[] |
toStringArray(Object[] objs)
Converts the given object array to a String array by calling toString in each object |
static char |
toUpperCase(char c)
converts the char to upper case letter |
static String |
toUpperCase(String s)
converts the string to upper case letters |
static String |
unsigned2hex(int b,
int places)
Returns a String with the convertion of the unsigned integer to hexadecimal, using the given number of places (up to 8). |
static String |
zeroPad(String s,
int size)
pads the string with zeroes at left |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
public static CharacterConverter charConverter
public static final long MIN_LONG_VALUE
public static final long MAX_LONG_VALUE
Method Detail |
public static String[] cloneStringArray(String[] strs)
public static String[] toStringArray(Object[] objs)
public static int toInt(String s)
public static String toString(boolean b)
public static String toString(char c)
public static int toIntBitwise(float f)
public static float toFloatBitwise(int i)
public static String toString(float f)
public static String toString(int i)
public static String toString(double d, int precision)
public static double toDouble(String s)
public static String toString(float f, int d)
public static float toFloat(String s)
public static String toString(String doubleValue, int n)
public static long doubleToLongBits(double value)
Bit 63 represents the sign of the floating-point number. Bits 62-52 represent the exponent. Bits 51-0 represent the significand (sometimes called the mantissa) of the floating-point number.
If the argument is positive infinity, the result is
0x7ff0000000000000L
.
If the argument is negative infinity, the result is
0xfff0000000000000L
.
If the argument is NaN, the result is
0x7ff8000000000000L
.
value
- a double precision floating-point number.public static double longBitsToDouble(long bits)
If the argument is 0x7f80000000000000L
, the result
is positive infinity.
If the argument is 0xff80000000000000L
, the result
is negative infinity.
If the argument is any value in the range
0x7ff0000000000001L
through
0x7fffffffffffffffL
or in the range
0xfff0000000000001L
through
0xffffffffffffffffL
, the result is NaN. All IEEE 754
NaN values are, in effect, lumped together by the Java language
into a single value.
bits
- any long
integer.double
floating-point value with the same
bit pattern.public static int digitOf(char ch, int radix)
public static char forDigit(int digit, int radix)
public static String toString(long l)
public static String toString(long i, int radix)
public static long toLong(String s)
public static long toLong(String s, int radix)
public static String toString(double d)
public static String toUpperCase(String s)
public static String toLowerCase(String s)
public static char toLowerCase(char c)
public static char toUpperCase(char c)
public static String zeroPad(String s, int size)
public static String[] tokenizeString(String input, char delim)
public static String insertLineBreak(int maxWidth, char separator, FontMetrics fm, String text)
Convert.insertLineBreak(154,'|',getFontMetrics(getFont()),"This is a very long text and i dont want to waste my time parsing it to be fit in the MessageBox!");
maxWidth
- the maximum width that is permitted for each line. For a text used in the MessageBox class, use Settings.screenWidth-6
or a lower number.separator
- the separator that will divide each line. The MessageBox class uses '|' as the separatorfm
- the FontMetrics of the font you will use to display the texttext
- the text to be parsedpublic static void qsort(Object[] items, int first, int last)
public static String unsigned2hex(int b, int places)
public static long rol(long i, int n, int bits)
bits
. This differs from the
shift left operator (<<) in that the bits are not lost,
they are reinserted in order at the right.
Bits may be 4,8,16 or 32.public static long ror(long i, int n, int bits)
bits
. This differs from the
shift right operator (>>) in that the bits are not lost,
they are reinserted in order at the left.
Bits may be 4,8,16 or 32.public static int chars2int(String fourChars)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |