MySqlUnsignedIntegerConverter { public static BigDecimal convertUnsignedBigint(BigDecimal originalNumber) { if (originalNumber.compareTo(BigDecimal.ZERO) == -1) { return originalNumber.add(BIGINT_CORRECTION); } else { return originalNumber; } } private  MySqlUnsignedIntegerConverter(); static short convertUnsignedTinyint(short originalNumber); static int convertUnsignedSmallint(int originalNumber); static int convertUnsignedMediumint(int originalNumber); static long convertUnsignedInteger(long originalNumber); static BigDecimal convertUnsignedBigint(BigDecimal originalNumber);  }
@Test public void shouldConvertSignedBinlogBigintToUnsigned() { assertEquals(new BigDecimal("18446744073709551615"), MySqlUnsignedIntegerConverter.convertUnsignedBigint(new BigDecimal("-1"))); assertEquals(new BigDecimal("18446744073709551615"), MySqlUnsignedIntegerConverter.convertUnsignedBigint(new BigDecimal("18446744073709551615"))); }