Class util
java.lang.Object
|
+----util
- public class util
- extends Object
Stupid class that contains various simple but useful methods.
Written: Radu Sion
Version: 0.23
Source: util.java
-
util()
-
-
bytes2int(byte[])
- Creates a integer out of four bytes using the big endian technique
-
bytescat(byte[], byte[])
- Appends b2 to b1 and returns the result.
-
bytescut(int, int, byte[])
- Cuts between i1 and i2 in b (inclusive) and returns the result.
-
closeInputStream(InputStream)
-
-
closeOutputStream(OutputStream)
-
-
closeSocket(Socket)
-
-
getDigit(int, long)
- Returns the named digit from a long starting with digit 0 at
the rightmost position.
-
int2bytes(int)
- Returns a four bytes array representation of a integer using
big endian technique.
-
pow_int(int, int)
-
-
pow_long(long, long)
-
-
stringWidth(String, FontMetrics)
- Returns the pixel width of the specified string using the specified
fontmetric.
util
public util()
pow_int
public static int pow_int(int a,
int b)
pow_long
public static long pow_long(long a,
long b)
closeInputStream
public static void closeInputStream(InputStream ss)
closeOutputStream
public static void closeOutputStream(OutputStream ss)
closeSocket
public static void closeSocket(Socket ss)
bytescat
public static byte[] bytescat(byte b1[],
byte b2[])
- Appends b2 to b1 and returns the result.
bytescut
public static byte[] bytescut(int i1,
int i2,
byte b[])
- Cuts between i1 and i2 in b (inclusive) and returns the result.
Assuming i1
bytes2int
public static int bytes2int(byte data[])
- Creates a integer out of four bytes using the big endian technique
int2bytes
public static byte[] int2bytes(int data)
- Returns a four bytes array representation of a integer using
big endian technique.
getDigit
public static int getDigit(int position,
long value)
- Returns the named digit from a long starting with digit 0 at
the rightmost position.
No parameter checkings are done.
If some error detected then return is zero !!!
stringWidth
public static int stringWidth(String str,
FontMetrics fm)
- Returns the pixel width of the specified string using the specified
fontmetric.
- Returns:
- 0 in case of error, pozitive otherwise