com.sun.jdmk
Class UnsignedLong

java.lang.Object
  extended by java.lang.Number
      extended by com.sun.jdmk.UnsignedLong
All Implemented Interfaces:
Serializable, Comparable

public class UnsignedLong
extends Number
implements Comparable

An unsigned integer, between 0 and 264 - 1. Objects of this class and its subclasses are immutable.

Since:
Java DMK 5.1
See Also:
Serialized Form

Field Summary
static UnsignedLong MAX_VALUE
          The largest representable UnsignedLong value, equal to 264 - 1.
 
Constructor Summary
UnsignedLong(long value)
          Deprecated. Use make(long) instead.
 
Method Summary
 UnsignedLong add(UnsignedLong x)
          Return an UnsignedLong that is equal mod 264 to this + x.
 UnsignedLong and(UnsignedLong x)
          Return an UnsignedLong that is the bitwise and of this and x.
 UnsignedLong clearBit(int n)
          Return an UnsignedLong that has the designated bit clear.
 int compareTo(long x)
          Returns a value that is negative, zero, or positive according as the value represented by this is respectively less than, equal to, or greater to x.
 int compareTo(Object o)
           
static UnsignedLong decode(String s)
          Return an UnsignedLong whose value is specified by the given String, including a possible prefix indicating the radix.
 UnsignedLong divide(UnsignedLong x)
          Return an UnsignedLong that is equal to [this / x], where [x] is the floor function.
 double doubleValue()
          Return the representable double that is nearest to this unsigned number.
 boolean equals(Object o)
           
 float floatValue()
          Return the representable float that is nearest to this unsigned number.
 int hashCode()
           
 int intValue()
          Return an int that is equal mod 232 to this unsigned number.
 long longValue()
          Return a long that is equal mod 264 to this unsigned number.
static UnsignedLong make(long x)
          Make an UnsignedLong object representing a value between 0 and 264 that is equal mod 264 to x.
 UnsignedLong max(UnsignedLong x)
          Return the larger of this and x.
 UnsignedLong min(UnsignedLong x)
          Return the smaller of this and x.
 UnsignedLong mod(UnsignedLong x)
          Return an UnsignedLong that is equal to this mod x.
 UnsignedLong multiply(UnsignedLong x)
          Return an UnsignedLong that is equal mod 264 to this * x.
 UnsignedLong not()
          Return an UnsignedLong that is the bitwise not of this, equal to 264 - 1 - this.
 UnsignedLong or(UnsignedLong x)
          Return an UnsignedLong that is the bitwise or of this and x.
 UnsignedLong setBit(int n)
          Return an UnsignedLong that has the designated bit set.
 UnsignedLong shiftLeft(int n)
          Return an UnsignedLong that is equal mod 264 to [this * 2n], where [x] is the floor function.
 UnsignedLong shiftRight(int n)
          Return an UnsignedLong that is equal mod 264 to [this / 2n], where [x] is the floor function.
 UnsignedLong subtract(UnsignedLong x)
          Return an UnsignedLong that is equal mod 264 to this - x.
 boolean testBit(int n)
          Return true if and only if the bit representing 2n is set in this.
static String toBinaryString(UnsignedLong u)
          Return a String that is the binary representation of this unsigned number, without extra leading zeroes.
static String toHexString(UnsignedLong u)
          Return a String that is the hexadecimal representation of this unsigned number, without extra leading zeroes.
static String toOctalString(UnsignedLong u)
          Return a String that is the octal representation of this unsigned number, without extra leading zeroes.
 String toString()
          Return a String that is the decimal representation of this unsigned number.
static UnsignedLong valueOf(String s)
          Return an UnsignedLong whose value is specified by the given String in decimal.
static UnsignedLong valueOf(String s, int radix)
          Return an UnsignedLong whose value is specified by the given String in the given radix.
 UnsignedLong xor(UnsignedLong x)
          Return an UnsignedLong that is the bitwise xor of this and x.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE

public static final UnsignedLong MAX_VALUE
The largest representable UnsignedLong value, equal to 264 - 1.

Constructor Detail

UnsignedLong

public UnsignedLong(long value)
Deprecated. Use make(long) instead.

An unsigned value between 0 and 264 that is equal mod 264 to value.

Method Detail

make

public static UnsignedLong make(long x)
Make an UnsignedLong object representing a value between 0 and 264 that is equal mod 264 to x.


intValue

public int intValue()
Return an int that is equal mod 232 to this unsigned number.

Specified by:
intValue in class Number

longValue

public long longValue()
Return a long that is equal mod 264 to this unsigned number.

Specified by:
longValue in class Number

doubleValue

public double doubleValue()
Return the representable double that is nearest to this unsigned number.

Specified by:
doubleValue in class Number

floatValue

public float floatValue()
Return the representable float that is nearest to this unsigned number.

Specified by:
floatValue in class Number

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

compareTo

public int compareTo(long x)
Returns a value that is negative, zero, or positive according as the value represented by this is respectively less than, equal to, or greater to x.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Return a String that is the decimal representation of this unsigned number.

Overrides:
toString in class Object

toHexString

public static String toHexString(UnsignedLong u)
Return a String that is the hexadecimal representation of this unsigned number, without extra leading zeroes. Lowercase letters are used for the digits a to f.

See Also:
Long.toHexString(long)

toOctalString

public static String toOctalString(UnsignedLong u)
Return a String that is the octal representation of this unsigned number, without extra leading zeroes.

See Also:
Long.toOctalString(long)

toBinaryString

public static String toBinaryString(UnsignedLong u)
Return a String that is the binary representation of this unsigned number, without extra leading zeroes.

See Also:
Long.toBinaryString(long)

valueOf

public static UnsignedLong valueOf(String s)
                            throws NumberFormatException
Return an UnsignedLong whose value is specified by the given String in decimal. Equivalent to valueOf(s, 10)

Throws:
NumberFormatException

valueOf

public static UnsignedLong valueOf(String s,
                                   int radix)
                            throws NumberFormatException
Return an UnsignedLong whose value is specified by the given String in the given radix.

Parameters:
s - a String representing an unsigned integer in the given radix. The characters in s must all be digits of the specified radix (as determined by whether Character.digit returns a nonnegative value).
radix - the radix in which the digits in s are expressed.
Throws:
NumberFormatException - if s is empty, or contains characters that are not digits of the specified radix, or specifies a value that is >= 264, or if the radix is not between Character.MIN_RADIX and Character.MAX_RADIX.

decode

public static UnsignedLong decode(String s)
                           throws NumberFormatException
Return an UnsignedLong whose value is specified by the given String, including a possible prefix indicating the radix. If the String begins with 0x or #, the remainder of the String specifies a hexadecimal number. If the String begins with 0 followed by other digits, the remainder of the String specifies an octal number. Otherwise, the String specifies a decimal number.

Throws:
NumberFormatException - if s is empty, or contains no characters after the prefix, or contains characters that are not digits of the specified radix, or specifies a value that is >= 264.

add

public UnsignedLong add(UnsignedLong x)
Return an UnsignedLong that is equal mod 264 to this + x.


subtract

public UnsignedLong subtract(UnsignedLong x)
Return an UnsignedLong that is equal mod 264 to this - x.


multiply

public UnsignedLong multiply(UnsignedLong x)
Return an UnsignedLong that is equal mod 264 to this * x.


divide

public UnsignedLong divide(UnsignedLong x)
                    throws ArithmeticException
Return an UnsignedLong that is equal to [this / x], where [x] is the floor function.

Throws:
ArithmeticException - if x is zero.

mod

public UnsignedLong mod(UnsignedLong x)
                 throws ArithmeticException
Return an UnsignedLong that is equal to this mod x.

Throws:
ArithmeticException - if x is zero.

shiftLeft

public UnsignedLong shiftLeft(int n)
Return an UnsignedLong that is equal mod 264 to [this * 2n], where [x] is the floor function. n may be negative.


shiftRight

public UnsignedLong shiftRight(int n)
Return an UnsignedLong that is equal mod 264 to [this / 2n], where [x] is the floor function. n may be negative.


and

public UnsignedLong and(UnsignedLong x)
Return an UnsignedLong that is the bitwise and of this and x.


or

public UnsignedLong or(UnsignedLong x)
Return an UnsignedLong that is the bitwise or of this and x.


xor

public UnsignedLong xor(UnsignedLong x)
Return an UnsignedLong that is the bitwise xor of this and x.


not

public UnsignedLong not()
Return an UnsignedLong that is the bitwise not of this, equal to 264 - 1 - this.


testBit

public boolean testBit(int n)
Return true if and only if the bit representing 2n is set in this.


setBit

public UnsignedLong setBit(int n)
Return an UnsignedLong that has the designated bit set. This means that the bitwise or of this and 2n.


clearBit

public UnsignedLong clearBit(int n)
Return an UnsignedLong that has the designated bit clear. This means the bitwise and of this and 264 - 1 - n.


min

public UnsignedLong min(UnsignedLong x)
Return the smaller of this and x.


max

public UnsignedLong max(UnsignedLong x)
Return the larger of this and x.


Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.