phelps.lang

Class Integers

public class Integers extends Object

Extensions to java.lang.Integer.

Version: $Revision: 1.5 $ $Date: 2003/11/27 18:40:29 $

Field Summary
static IntegerONE
static IntegerTWO
static IntegerZERO
Method Summary
static intcountOneBits(int value)
Returns number of 1-bits in 4-byte integer value.
static IntegergetInteger(int val)
Caches java.lang.Integer objects, so the 1000s of instances of 0 all share the same Java object.
static intparseHex(int ch1, int ch2)
Interprets ch1 and ch2 as pair of hexidecimal characters, and returns combined 8-bit value.
static intparseInt(String value, int defaultval)
Tries to parse value as an int, but if String is null or can't be parsed as an int returns defaultval .
static intparseInt(int ch)
Interprets ch as ASCII character in radix up to 36, and returns value, or if not hex returns -1.
static StringtoRomanString(int val)
Returns Roman numeral representation of numbers >0 && <=4000 (no numbers which require a bar to multiply by 1000).
static StringtoString(int val)

Field Detail

ONE

public static final Integer ONE

TWO

public static final Integer TWO

ZERO

public static final Integer ZERO

Method Detail

countOneBits

public static int countOneBits(int value)
Returns number of 1-bits in 4-byte integer value.

getInteger

public static Integer getInteger(int val)
Caches java.lang.Integer objects, so the 1000s of instances of 0 all share the same Java object.

parseHex

public static int parseHex(int ch1, int ch2)
Interprets ch1 and ch2 as pair of hexidecimal characters, and returns combined 8-bit value.

parseInt

public static int parseInt(String value, int defaultval)
Tries to parse value as an int, but if String is null or can't be parsed as an int returns defaultval .

parseInt

public static int parseInt(int ch)
Interprets ch as ASCII character in radix up to 36, and returns value, or if not hex returns -1. Radixes > 10 use letters, which may be lower or uppercase.

toRomanString

public static String toRomanString(int val)
Returns Roman numeral representation of numbers >0 && <=4000 (no numbers which require a bar to multiply by 1000). Numeral returned in uppercase; client can convert to lowercase. Numbers <0 or >=4000 are returned in Arabic. Used by HTML OL.

toString

public static String toString(int val)