UInteger m = new UInteger(5); UInteger t = new UInteger(18); UInteger x = new UInteger(42); UInteger y = x.multiplyBy(m); y = y.add(t);
/** * Create an <code>unsigned short</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned short</code> * @see UShort#valueOf(int) */ public static UShort ushort(int value) throws NumberFormatException { return UShort.valueOf(value); }
/** * Get an instance of an <code>unsigned byte</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned byte</code> */ public static UByte valueOf(short value) throws NumberFormatException { return valueOfUnchecked(rangeCheck(value)); }
/** * Create an <code>unsigned long</code> by masking it with * <code>0xFFFFFFFFFFFFFFFF</code> i.e. <code>(long) -1</code> becomes * <code>(uint) 18446744073709551615</code> * * @see ULong#valueOf(long) */ public static ULong ulong(long value) { return ULong.valueOf(value); }
/** * Create an <code>unsigned byte</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned byte</code> * @see UByte#valueOf(short) */ public static UByte ubyte(long value) throws NumberFormatException { return UByte.valueOf(value); }
/** * Create an <code>unsigned int</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned byte</code> */ public static UInteger valueOf(long value) throws NumberFormatException { return valueOfUnchecked(rangeCheck(value)); }
/** * Create an <code>unsigned int</code> by masking it with * <code>0xFFFFFFFF</code> i.e. <code>(int) -1</code> becomes * <code>(uint) 4294967295</code> * * @see UInteger#valueOf(int) */ public static UInteger uint(int value) { return UInteger.valueOf(value); }
/** * Create an <code>unsigned long</code> * * @throws NumberFormatException If <code>value</code> does not contain a * parsable <code>unsigned long</code>. */ public static ULong valueOf(String value) throws NumberFormatException { return new ULong(value); }
/** * Get the whole interval in days */ public final double getTotalDays() { return getSign() * ( nano / (24.0 * 3600.0 * 1000000000.0) + seconds / (24.0 * 3600.0) + minutes / (24.0 * 60.0) + hours / 24.0 + days); }
/** * Create an <code>unsigned short</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned short</code> */ private UShort(int value) throws NumberFormatException { this.value = value; rangeCheck(); }
/** * Create an <code>unsigned short</code> by masking it with * <code>0xFFFF</code> i.e. <code>(short) -1</code> becomes * <code>(ushort) 65535</code> */ public static UShort valueOf(short value) { return new UShort(value); }
/** * Generate a cached value for each byte value. * * @return Array of cached values for UByte. */ private static final UByte[] mkValues() { UByte[] ret = new UByte[256]; for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) ret[i & MAX_VALUE] = new UByte((byte) i); return ret; }
@Override public UShort convert(Short in, Context context) throws Exception { if (in == null) { return null; } return UShort.valueOf(in); } });
/** * Get an instance of an <code>unsigned byte</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned byte</code> */ public static UByte valueOf(int value) throws NumberFormatException { return valueOfUnchecked(rangeCheck(value)); }
@Override public ULong convert(Long in, Context context) throws Exception { if (in == null) { return null; } return ULong.valueOf(in); } });
@Override public UByte convert(Integer in, Context context) throws Exception { if (in == null) { return null; } return UByte.valueOf(in); } });
/** * Create an <code>unsigned long</code> by masking it with * <code>0xFFFFFFFFFFFFFFFF</code> i.e. <code>(long) -1</code> becomes * <code>(uint) 18446744073709551615</code> */ public static ULong valueOf(long value) { return new ULong(value); }
/** * Get the whole interval in milli-seconds */ public final double getTotalMilli() { return getSign() * ( nano / 1000000.0 + 1000.0 * seconds + 1000.0 * 60.0 * minutes + 1000.0 * 3600.0 * hours + 1000.0 * 3600.0 * 24.0 * days); }
@Override public UShort convert(Short in, Context context) throws Exception { if (in == null) { return null; } return UShort.valueOf(in); } });
/** * Create an <code>unsigned short</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned short</code> * @see UShort#valueOf(int) */ public static UShort ushort(int value) throws NumberFormatException { return UShort.valueOf(value); }