ByteBuffer to Big Decimal - Java java.math

Java examples for java.math:BigDecimal Convert

Description

ByteBuffer to Big Decimal

Demo Code


//package com.java2s;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;

public class Main {
    public static BigDecimal toBigDecimal(ByteBuffer avroDecimal, int scale) {
        return new BigDecimal(new BigInteger(avroDecimal.array()), scale);
    }// ww w .j  av a 2s . c o m
}

Related Tutorials