@Test
public void testMultiply() {

  assertEquals(
      BigInteger.ZERO,
      new CompUInt128(0).multiply(new CompUInt128(0)).toBigInteger()
  );
  assertEquals(
      BigInteger.ZERO,
      new CompUInt128(1).multiply(new CompUInt128(0)).toBigInteger()
  );
  assertEquals(
      BigInteger.ZERO,
      new CompUInt128(0).multiply(new CompUInt128(1)).toBigInteger()
  );
  assertEquals(
      BigInteger.ZERO,
      new CompUInt128(1024).multiply(new CompUInt128(0)).toBigInteger()
  );
  assertEquals(
      BigInteger.ZERO,
      new CompUInt128(twoTo128.subtract(BigInteger.ONE)).multiply(new CompUInt128(0))
          .toBigInteger()
  );
  assertEquals(
      BigInteger.ONE,
      new CompUInt128(1).multiply(new CompUInt128(1)).toBigInteger()
  );
  assertEquals(
      twoTo128.subtract(BigInteger.ONE),
      new CompUInt128(new CompUInt128(1))
          .multiply(new CompUInt128(twoTo128.subtract(BigInteger.ONE)))
          .toBigInteger()
  );
  assertEquals(
      twoTo128.subtract(BigInteger.ONE),
      new CompUInt128(twoTo128.subtract(BigInteger.ONE)).multiply(new CompUInt128(1))
          .toBigInteger()
  );
  // multiply no overflow
  assertEquals(
      new BigInteger("42").multiply(new BigInteger("7")),
      new CompUInt128(new BigInteger("42")).multiply(new CompUInt128(new BigInteger("7")))
          .toBigInteger()
  );
  // multiply with overflow
  assertEquals(
      new BigInteger("42").multiply(twoTo128.subtract(BigInteger.ONE)).mod(twoTo128),
      new CompUInt128(new BigInteger("42"))
          .multiply(new CompUInt128(twoTo128.subtract(BigInteger.ONE)))
          .toBigInteger()
  );
  assertEquals(
      twoTo64.multiply(twoTo64.add(BigInteger.TEN)).mod(twoTo128),
      new CompUInt128(twoTo64)
          .multiply(new CompUInt128(twoTo64.add(BigInteger.TEN)))
          .toBigInteger()
  );
}