BigDecimal to Byte Buffer - Java java.math

Java examples for java.math:BigDecimal Convert

Description

BigDecimal to Byte Buffer

Demo Code


//package com.java2s;
import java.math.BigDecimal;

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer toByteBuffer(BigDecimal decimal) {
        return ByteBuffer.wrap(decimal.unscaledValue().toByteArray());
    }/*from   w  w w.  j a  v  a  2s  . c o  m*/
}

Related Tutorials