Example usage for java.math BigDecimal valueOf

List of usage examples for java.math BigDecimal valueOf

Introduction

In this page you can find the example usage for java.math BigDecimal valueOf.

Prototype

public static BigDecimal valueOf(long unscaledVal, int scale) 

Source Link

Document

Translates a long unscaled value and an int scale into a BigDecimal .

Usage

From source file:org.openmhealth.shim.withings.mapper.WithingsBodyMeasureDataPointMapper.java

/**
 * @return a {@link BigDecimal} corresponding to the specified measure node
 *//*  w ww.  ja va 2s .c o  m*/
protected BigDecimal getValue(JsonNode measureNode) {

    long unscaledValue = asRequiredLong(measureNode, "value");
    int scale = asRequiredInteger(measureNode, "unit");

    return BigDecimal.valueOf(unscaledValue, -1 * scale);

}