1 package gnu.math; 2 3 public class UByte extends UnsignedPrim implements Comparable<UByte> { 4 byte ival; numBits()5 public int numBits() { return 8; } 6 UByte(byte ival)7 public UByte(byte ival) { this.ival = ival; } 8 valueOf(byte ival)9 public static UByte valueOf(byte ival) { return new UByte(ival); } 10 intValue()11 public int intValue() { return ival & 0xFF; } 12 toIntNum()13 public IntNum toIntNum() { return IntNum.valueOf(ival & 0xFFFF); } 14 equals(Object obj)15 public boolean equals(Object obj) { 16 return obj instanceof UByte 17 && ival == ((UByte) obj).ival; 18 } 19 compareTo(UByte other)20 public int compareTo(UByte other) { 21 return intValue() - other.intValue(); 22 } 23 toString(byte ival)24 public static String toString(byte ival) { 25 return Integer.toString(ival & 0xFF); 26 } toString()27 public String toString() { return toString(ival); } 28 } 29