@Test void shouldThrowForDivideByZero() { Throwable exception = assertThrows(ArithmeticException.class, () -> v(5).divide(v(0))); assertEquals("divide by zero", exception.getMessage()); }
@Override public UInt384 divide(UInt384 value) { if (value.isZero()) { throw new ArithmeticException("divide by zero"); } if (value.equals(UInt384.ONE)) { return this; } return UInt384.valueOf(toBigInteger().divide(value.toBigInteger())); }
UInt384 implements UInt384Value<UInt384> { @Override public UInt384 divide(UInt384 value) { if (value.isZero()) { throw new ArithmeticException("divide by zero"); } if (value.equals(UInt384.ONE)) { return this; } return UInt384.valueOf(toBigInteger().divide(value.toBigInteger())); } }
UInt384 implements UInt384Value<UInt384> { @Override public UInt384 divide(UInt384 value) { if (value.isZero()) { throw new ArithmeticException("divide by zero"); } if (value.equals(UInt384.ONE)) { return this; } return UInt384.valueOf(toBigInteger().divide(value.toBigInteger())); } private  UInt384(Bytes48 bytes); private  UInt384(long value); private  UInt384(int[] ints); }
UInt384 implements UInt384Value<UInt384> { @Override public UInt384 divide(UInt384 value) { if (value.isZero()) { throw new ArithmeticException("divide by zero"); } if (value.equals(UInt384.ONE)) { return this; } return UInt384.valueOf(toBigInteger().divide(value.toBigInteger())); } private  UInt384(Bytes48 bytes); private  UInt384(long value); private  UInt384(int[] ints); static UInt384 valueOf(long value); static UInt384 valueOf(BigInteger value); static UInt384 fromBytes(Bytes bytes); static UInt384 fromHexString(String str); @SuppressWarnings("ReferenceEquality") @Override boolean isZero(); @Override UInt384 add(UInt384 value); @Override UInt384 add(long value); @Override UInt384 addMod(UInt384 value, UInt384 modulus); @Override UInt384 addMod(long value, UInt384 modulus); @Override UInt384 addMod(long value, long modulus); @Override UInt384 subtract(UInt384 value); @Override UInt384 subtract(long value); @Override UInt384 multiply(UInt384 value); @Override UInt384 multiply(long value); @Override UInt384 multiplyMod(UInt384 value, UInt384 modulus); @Override UInt384 multiplyMod(long value, UInt384 modulus); @Override UInt384 multiplyMod(long value, long modulus); @Override UInt384 divide(UInt384 value); @Override UInt384 divide(long value); @Override UInt384 pow(UInt384 exponent); @Override UInt384 pow(long exponent); @Override UInt384 mod(UInt384 modulus); @Override UInt384 mod(long modulus); UInt384 and(UInt384 value); UInt384 and(Bytes48 bytes); UInt384 or(UInt384 value); UInt384 or(Bytes48 bytes); UInt384 xor(UInt384 value); UInt384 xor(Bytes48 bytes); UInt384 not(); UInt384 shiftRight(int distance); UInt384 shiftLeft(int distance); @Override boolean equals(Object object); @Override int hashCode(); @Override int compareTo(UInt384 other); @Override boolean fitsInt(); @Override int intValue(); @Override boolean fitsLong(); @Override long toLong(); @Override String toString(); @Override BigInteger toBigInteger(); @Override UInt384 toUInt384(); @Override Bytes48 toBytes(); @Override Bytes toMinimalBytes(); @Override int numberOfLeadingZeros(); @Override int bitLength(); }
UInt384 implements UInt384Value<UInt384> { @Override public UInt384 divide(UInt384 value) { if (value.isZero()) { throw new ArithmeticException("divide by zero"); } if (value.equals(UInt384.ONE)) { return this; } return UInt384.valueOf(toBigInteger().divide(value.toBigInteger())); } private  UInt384(Bytes48 bytes); private  UInt384(long value); private  UInt384(int[] ints); static UInt384 valueOf(long value); static UInt384 valueOf(BigInteger value); static UInt384 fromBytes(Bytes bytes); static UInt384 fromHexString(String str); @SuppressWarnings("ReferenceEquality") @Override boolean isZero(); @Override UInt384 add(UInt384 value); @Override UInt384 add(long value); @Override UInt384 addMod(UInt384 value, UInt384 modulus); @Override UInt384 addMod(long value, UInt384 modulus); @Override UInt384 addMod(long value, long modulus); @Override UInt384 subtract(UInt384 value); @Override UInt384 subtract(long value); @Override UInt384 multiply(UInt384 value); @Override UInt384 multiply(long value); @Override UInt384 multiplyMod(UInt384 value, UInt384 modulus); @Override UInt384 multiplyMod(long value, UInt384 modulus); @Override UInt384 multiplyMod(long value, long modulus); @Override UInt384 divide(UInt384 value); @Override UInt384 divide(long value); @Override UInt384 pow(UInt384 exponent); @Override UInt384 pow(long exponent); @Override UInt384 mod(UInt384 modulus); @Override UInt384 mod(long modulus); UInt384 and(UInt384 value); UInt384 and(Bytes48 bytes); UInt384 or(UInt384 value); UInt384 or(Bytes48 bytes); UInt384 xor(UInt384 value); UInt384 xor(Bytes48 bytes); UInt384 not(); UInt384 shiftRight(int distance); UInt384 shiftLeft(int distance); @Override boolean equals(Object object); @Override int hashCode(); @Override int compareTo(UInt384 other); @Override boolean fitsInt(); @Override int intValue(); @Override boolean fitsLong(); @Override long toLong(); @Override String toString(); @Override BigInteger toBigInteger(); @Override UInt384 toUInt384(); @Override Bytes48 toBytes(); @Override Bytes toMinimalBytes(); @Override int numberOfLeadingZeros(); @Override int bitLength(); final static UInt384 MIN_VALUE; final static UInt384 MAX_VALUE; final static UInt384 ZERO; final static UInt384 ONE; }