Operation { protected static long toXdrAmount(String value) { value = checkNotNull(value, "value cannot be null"); BigDecimal amount = new BigDecimal(value).multiply(Operation.ONE); return amount.longValueExact(); } Operation(); kin.base.xdr.Operation toXdr(); String toXdrBase64(); static Operation fromXdr(kin.base.xdr.Operation xdr); KeyPair getSourceAccount();  }
@Test public void testToXdrAmount() { assertEquals(0L, Operation.toXdrAmount("0")); assertEquals(1L, Operation.toXdrAmount("0.00001")); assertEquals(10000000L, Operation.toXdrAmount("100")); assertEquals(11234567L, Operation.toXdrAmount("112.34567")); assertEquals(729912843007381L, Operation.toXdrAmount("7299128430.07381")); assertEquals(729912843007381L, Operation.toXdrAmount("7299128430.073810")); assertEquals(1014016711446800155L, Operation.toXdrAmount("10140167114468.00155")); assertEquals(9223372036854775807L, Operation.toXdrAmount("92233720368547.75807")); try { Operation.toXdrAmount("0.000001"); fail(); } catch (ArithmeticException e) { } catch (Exception e) { fail(); } try { Operation.toXdrAmount("7299128430.073811"); fail(); } catch (ArithmeticException e) { } catch (Exception e) { fail(); } }