Example usage for java.math BigInteger TEN

List of usage examples for java.math BigInteger TEN

Introduction

In this page you can find the example usage for java.math BigInteger TEN.

Prototype

BigInteger TEN

To view the source code for java.math BigInteger TEN.

Click Source Link

Document

The BigInteger constant ten.

Usage

From source file:Main.java

public static void main(String[] args) {
    BigInteger numberB = BigInteger.TEN;

}

From source file:Main.java

public static void main(String[] args) {
    BigInteger numberA = new BigInteger("98765432123456789");
    BigInteger numberB = BigInteger.TEN;

    numberA = numberA.add(numberB);//from w  w w.  j  av a2 s  .co  m
    System.out.println("numberA = " + numberA);

    numberA = numberA.multiply(numberB);
    System.out.println("numberA = " + numberA);

    numberA = numberA.subtract(numberB);
    System.out.println("numberA = " + numberA);

    numberA = numberA.divide(numberB);
    System.out.println("numberA = " + numberA);

    numberA = numberA.mod(numberB);
    System.out.println("numberA = " + numberA);

    numberA = numberA.pow(2);
    System.out.println("numberA = " + numberA);

    numberA = numberA.negate();
    System.out.println("numberA = " + numberA);
}

From source file:com.redhat.lightblue.metadata.types.BooleanTypeTest.java

@Test
public void testFromJson() {
    JsonNode jsonNode = JsonNodeFactory.withExactBigDecimals(false).numberNode(BigInteger.TEN);
    Object fromJson = booleanType.fromJson(jsonNode);
    assertTrue(fromJson instanceof Boolean);
}

From source file:com.vladmihalcea.mongo.dao.ProductRepositoryIT.java

@Test
public void testSave() {
    Product product = new Product();
    product.setId(123L);/*from  ww w. j  a  v  a  2  s.  c om*/
    product.setName("Tv");
    product.setQuantity(BigInteger.TEN);
    product.setDiscount(BigDecimal.valueOf(12.34));
    productRepository.save(product);
    Product savedProduct = productRepository.findOne(123L);
    assertEquals(savedProduct, product);
    assertEquals(savedProduct.hashCode(), product.hashCode());
    assertEquals(Long.valueOf(0), product.getVersion());
    assertEquals("Tv", product.getName());
    savedProduct.setName("Dvd");
    savedProduct = productRepository.save(savedProduct);
    assertEquals(Long.valueOf(1), savedProduct.getVersion());
    savedProduct.setVersion(0L);
    try {
        productRepository.save(savedProduct);
        fail("Expected OptimisticLockingFailureException");
    } catch (OptimisticLockingFailureException e) {
    }
    productRepository.delete(product);
}

From source file:com.redhat.lightblue.metadata.types.BigIntegerTypeTest.java

@Test
public void testFromJson() {
    JsonNode jsonNode = JsonNodeFactory.withExactBigDecimals(false).numberNode(BigInteger.TEN);
    Object fromJson = bigIntegerType.fromJson(jsonNode);
    assertTrue(fromJson instanceof BigInteger);
}

From source file:org.thymeleaf.util.EvaluationUtilTest.java

@Test
public void convertToBooleanTest() {

    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(null));

    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Boolean.TRUE));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Boolean.FALSE));

    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(BigDecimal.ZERO));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigDecimal.ONE));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigDecimal.TEN));

    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(BigInteger.ZERO));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigInteger.ONE));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigInteger.TEN));

    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Double.valueOf(0.0d)));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Float.valueOf(0.0f)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(0.1d)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(0.1f)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(-0.1d)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(-0.1f)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(Double.MAX_VALUE)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(Float.MAX_VALUE)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(Double.MIN_VALUE)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(Float.MIN_VALUE)));

    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Character.valueOf((char) 0)));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('x')));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('0')));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('1')));

    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("true"));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("false"));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("yes"));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("no"));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("on"));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("off"));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("sky"));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("high above"));

    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("true")));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("false")));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("yes")));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("no")));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("on")));
    Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("off")));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("sky")));
    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("high above")));

    Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(EvaluationUtil.class));

}

From source file:co.rsk.core.NetworkStateExporterTest.java

@Test
public void testNoContracts() throws Exception {
    Repository repository = new RepositoryImpl(new TrieStoreImpl(new HashMapDB()));
    String address1String = "1000000000000000000000000000000000000000";
    byte[] address1 = Hex.decode(address1String);
    repository.createAccount(address1);/*from   www.j av a2 s  .c o m*/
    repository.addBalance(address1, BigInteger.ONE);
    repository.increaseNonce(address1);
    String address2String = "2000000000000000000000000000000000000000";
    byte[] address2 = Hex.decode(address2String);
    repository.createAccount(address2);
    repository.addBalance(address2, BigInteger.TEN);
    repository.increaseNonce(address2);
    repository.increaseNonce(address2);

    byte[] remascSender = ZERO_BYTE_ARRAY;
    repository.createAccount(remascSender);
    repository.increaseNonce(remascSender);

    byte[] remascAddr = Hex.decode(PrecompiledContracts.REMASC_ADDR);
    repository.createAccount(remascAddr);
    repository.addBalance(remascAddr, BigInteger.TEN);
    repository.increaseNonce(remascAddr);

    Map result = writeAndReadJson(repository);
    Assert.assertEquals(3, result.keySet().size());

    Map address1Value = (Map) result.get(address1String);
    Assert.assertEquals(2, address1Value.keySet().size());
    Assert.assertEquals("1", address1Value.get("balance"));
    Assert.assertEquals("1", address1Value.get("nonce"));

    Map address2Value = (Map) result.get(address2String);
    Assert.assertEquals(2, address2Value.keySet().size());
    Assert.assertEquals("10", address2Value.get("balance"));
    Assert.assertEquals("2", address2Value.get("nonce"));

    Map remascValue = (Map) result.get(PrecompiledContracts.REMASC_ADDR);
    Assert.assertEquals(2, remascValue.keySet().size());
    Assert.assertEquals("10", remascValue.get("balance"));
    Assert.assertEquals("1", remascValue.get("nonce"));
}

From source file:com.asakusafw.directio.hive.parquet.DecimalValueDriver.java

static int getByteLength(int precision) {
    if (precision == 0) {
        return 1;
    }//from  w  w w.j  a  v a2 s.  c  om
    int bits = BigInteger.TEN.pow(precision).bitLength() + 1;
    return (bits + Byte.SIZE - 1) / Byte.SIZE;
}

From source file:com.github.jrrdev.mantisbtsync.core.jobs.issues.writers.BugHistoryWriterTest.java

/**
 * Build the items to write.//from   w w w.j  a  v a2 s .c om
 *
 * @return items
 */
private List<BugBean> buildItems() {

    final Calendar cal = Calendar.getInstance();
    final Timestamp date = new Timestamp(cal.getTimeInMillis());
    final List<BugBean> items = new ArrayList<BugBean>();

    final BugBean item1 = new BugBean();
    final BugHistoryBean hist = new BugHistoryBean();
    hist.setBugId(BigInteger.ONE);
    hist.setUserId(BigInteger.ONE);
    hist.setOldValue("old");
    hist.setNewValue("new");
    hist.setHistoryType(BigInteger.TEN);
    hist.setDateModified(date);

    item1.getHistory().add(hist);
    items.add(item1);

    return items;
}

From source file:com.redhat.lightblue.metadata.types.BigIntegerTypeTest.java

@Test
public void testCastGoodString() {
    assertTrue(bigIntegerType.cast(String.valueOf(BigInteger.TEN)) instanceof BigInteger);
}