Multivalent API

phelps.lang
Class Integers

java.lang.Object
  extended by phelps.lang.Integers

public class Integers
extends java.lang.Object

Extensions to Integer.

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

Field Summary
static int[] ARRAY0
           
static java.lang.Integer ONE
           
static java.lang.Integer TWO
           
static java.lang.Integer ZERO
           
 
Method Summary
static int bitCount(int value)
          Returns number of 1-bits in 2's complement representation of 4-byte integer value.
static java.lang.Integer getInteger(int val)
          Caches Integer objects, so the 1000s of instances of 0 all share the same Java object.
static int parseHex(int ch1, int ch2)
          Interprets ch1 and ch2 as pair of hexidecimal characters, and returns combined 8-bit value.
static int parseInt(int ch)
          Interprets ch as ASCII character in radix up to 36, and returns value, or if not hex returns -1.
static int parseInt(java.lang.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 java.lang.String toRomanString(int val)
          Returns Roman numeral representation of numbers >0 && <=4000 (no numbers which require a bar to multiply by 1000).
static java.lang.String toString(int val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARRAY0

public static final int[] ARRAY0

ZERO

public static final java.lang.Integer ZERO

ONE

public static final java.lang.Integer ONE

TWO

public static final java.lang.Integer TWO
Method Detail

parseInt

public static int parseInt(java.lang.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.


parseHex

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


getInteger

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


toRomanString

public static java.lang.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.


bitCount

public static int bitCount(int value)
Returns number of 1-bits in 2's complement representation of 4-byte integer value. To be replaced by Integer.bitCount(int) in Java 1.5.


toString

public static java.lang.String toString(int val)

Multivalent API