List of usage examples for java.math BigDecimal BigDecimal
public BigDecimal(long val)
From source file:io.wcm.caravan.io.jsontransform.source.JacksonStreamSourceTest.java
@Test public void test_simple() throws JsonParseException, IOException { String json = "{\"key1\":\"value1\",\"obj1\":{\"key2\":2},\"array1\":[\"value3\"]}}"; JacksonStreamSource source = new JacksonStreamSource(new ByteArrayInputStream(json.getBytes())); new JsonTestHelper(source).assertStartObject().assertValue("key1", "value1").assertStartObject("obj1") .assertValue("key2", new BigDecimal(2)).assertEndObject().assertStartArray("array1") .assertValue("value3").assertEndArray().assertEndObject(); }
From source file:com.illumina.basespace.util.BigDecimalDeserializer.java
@Override public BigDecimal deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { try {//from www .j a va2 s . com return new BigDecimal(parser.getText()); } catch (Throwable t) { logger.log(Level.SEVERE, "Error deserializing bigdecimal from JSON object", t); return null; } }
From source file:com.creditcloud.interestbearing.ta.message.asset.UserQueryLatestAssetResponseMessage.java
public BigDecimal getFairValue() { return new BigDecimal(fair_value); }
From source file:com.dolgoter.configuration.TrainerConfig.java
@Bean @Qualifier("invalid_firstname") public Trainer getTrainerInvalidFirstname() { Trainer mour = new Trainer("Jose2", "Mourinho", 45, new ArrayList<Team>()); mour.setSalary(new Salary(new BigDecimal(1000000))); return mour;/*from w ww .j a va 2 s . c om*/ }
From source file:com.espertech.esper.epl.agg.aggregator.AggregatorAvgBigDecimal.java
/** * Ctor./*from www .jav a 2s . c om*/ */ public AggregatorAvgBigDecimal(MathContext optionalMathContext) { sum = new BigDecimal(0.0); this.optionalMathContext = optionalMathContext; }
From source file:fsm.series.Series_CF.java
@Override public double getFunctionValue(double y, int m) { double um = getMu_m(m); double alphaM = (sin(um) + sinh(um)) / (cos(um) + cosh(um)); double km = um / a; BigDecimal Ym;/*from ww w . j a v a 2 s. c o m*/ BigDecimal cosh = new BigDecimal(-alphaM * -cosh(km * y)); BigDecimal sinh = new BigDecimal(-sinh(km * y)); BigDecimal sin = new BigDecimal(sin(km * y)); BigDecimal cos = new BigDecimal(-alphaM * cos(km * y)); Ym = (cos.add(sin).add(sinh).add(cosh)); return Ym.doubleValue(); }
From source file:com.hihframework.core.utils.StringHelpers.java
/** * To big decimal.// w w w . j ava2 s. com * * @param bigdecimal the bigdecimal * @return the big decimal */ public static BigDecimal toBigDecimal(final String bigdecimal) { if (bigdecimal == null) { return null; } if (bigdecimal.length() < 1) { return null; } try { return new BigDecimal(bigdecimal); } catch (final Exception e) { return null; } }
From source file:com.codecrate.shard.level.ConstantRateLevelCalculator.java
public int calculateValue(int level) { BigDecimal value = rate.multiply(new BigDecimal(level - 1)); value = value.add(new BigDecimal(initialValue)); value = value.setScale(0, BigDecimal.ROUND_HALF_UP); LOG.debug("Computed value for level " + level + " is: " + value); return value.intValue(); }
From source file:alfio.manager.support.FeeCalculator.java
private FeeCalculator(String feeAsString, String minimumFeeAsString, int numTickets) { this.percentage = feeAsString.endsWith("%"); this.fee = new BigDecimal(defaultIfEmpty(substringBefore(feeAsString, "%"), "0")); this.minimumFee = new BigDecimal(defaultIfEmpty(trimToNull(minimumFeeAsString), "0")); this.numTickets = numTickets; }
From source file:com.redhat.lightblue.crud.validator.MinMaxCheckerTest.java
/** * Col1: For debugging purposes to know which test case had issues * Col2: A instantiation to test with. Should always represent 2. *///from w ww.j av a2 s. co m @Parameters(name = "{index}: {0}") public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { Integer.class, new Integer(2) }, { Byte.class, new Byte(new Integer(2).byteValue()) }, { Short.class, new Short(new Integer(2).shortValue()) }, { Long.class, new Long(2L) }, { Float.class, new Float(2F) }, { Double.class, new Double(2D) }, { BigInteger.class, new BigInteger("2") }, { BigDecimal.class, new BigDecimal(2) } }); }