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


Constructor Index

 o util()

Method Index

 o bytes2int(byte[])
Creates a integer out of four bytes using the big endian technique
 o bytescat(byte[], byte[])
Appends b2 to b1 and returns the result.
 o bytescut(int, int, byte[])
Cuts between i1 and i2 in b (inclusive) and returns the result.
 o closeInputStream(InputStream)
 o closeOutputStream(OutputStream)
 o closeSocket(Socket)
 o getDigit(int, long)
Returns the named digit from a long starting with digit 0 at the rightmost position.
 o int2bytes(int)
Returns a four bytes array representation of a integer using big endian technique.
 o pow_int(int, int)
 o pow_long(long, long)
 o stringWidth(String, FontMetrics)
Returns the pixel width of the specified string using the specified fontmetric.

Constructors

 o util
 public util()

Methods

 o pow_int
 public static int pow_int(int a,
                           int b)
 o pow_long
 public static long pow_long(long a,
                             long b)
 o closeInputStream
 public static void closeInputStream(InputStream ss)
 o closeOutputStream
 public static void closeOutputStream(OutputStream ss)
 o closeSocket
 public static void closeSocket(Socket ss)
 o bytescat
 public static byte[] bytescat(byte b1[],
                               byte b2[])
Appends b2 to b1 and returns the result.

 o 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
 o bytes2int
 public static int bytes2int(byte data[])
Creates a integer out of four bytes using the big endian technique

 o int2bytes
 public static byte[] int2bytes(int data)
Returns a four bytes array representation of a integer using big endian technique.

 o 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 !!!

 o 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