|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvisad.browser.Convert
public class Convert
Utility methods for various conversions between primitive data types.
Field Summary | |
---|---|
static int |
PLACES
Number of significant digits after the decimal point. |
static int |
ROUND_DOWN
Mode where shortString rounds to the lower value. |
static int |
ROUND_NEAREST
Mode where shortString rounds to the nearest value. |
static int |
ROUND_UP
Mode where shortString rounds to the higher value. |
Constructor Summary | |
---|---|
Convert()
|
Method Summary | |
---|---|
static int[] |
bytesToInt(byte[] bytes)
Converts an array of bytes to an array of ints. |
static int[] |
decodeRLE(int[] array)
Decodes the given array of ints from a run-length encoding. |
static int[] |
encodeRLE(int[] array)
Encodes the given array of ints using a run-length scheme. |
static boolean |
getBoolean(String s)
Extracts a boolean from a string. |
static double |
getDouble(String s)
Extracts a double from a string. |
static float |
getFloat(String s)
Extracts a float from a string. |
static int |
getInt(String s)
Extracts an integer from a string. |
static byte[] |
intToBytes(int[] ints)
Converts an array of ints to an array of bytes. |
static String |
shortString(double val)
Gets a reasonably short string representation of a double for use in a graphical user interface. |
static String |
shortString(double val,
int mode)
Gets a reasonably short string representation of a double for use in a graphical user interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PLACES
public static final int ROUND_NEAREST
public static final int ROUND_DOWN
public static final int ROUND_UP
Constructor Detail |
---|
public Convert()
Method Detail |
---|
public static byte[] intToBytes(int[] ints)
ints
- The array of ints to be converted to a byte array
public static int[] bytesToInt(byte[] bytes)
bytes
- The array of bytes to be converted to an int array
public static int[] encodeRLE(int[] array)
array
- The array of ints to RLE-encode
public static int[] decodeRLE(int[] array)
array
- The RLE-encoded array of ints to decode
public static double getDouble(String s)
public static float getFloat(String s)
public static boolean getBoolean(String s)
public static int getInt(String s)
public static String shortString(double val)
public static String shortString(double val, int mode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |