Java Convert via ByteBuffer toBigDecimal(byte[] bytes, int scale)

Here you can find the source of toBigDecimal(byte[] bytes, int scale)

Description

to Big Decimal

License

Open Source License

Declaration

public static BigDecimal toBigDecimal(byte[] bytes, int scale) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;

public class Main {
    public static BigDecimal toBigDecimal(byte[] bytes, int scale) {
        return new BigDecimal(toBigInteger(bytes), scale);
    }//from w  w w.  j  av  a2  s  .c  o  m

    public static BigDecimal toBigDecimal(ByteBuffer buffer, int scale) {
        return new BigDecimal(toBigInteger(buffer), scale);
    }

    public static BigInteger toBigInteger(byte[] bytes) {
        return new BigInteger(bytes);
    }

    public static BigInteger toBigInteger(ByteBuffer buffer) {
        return new BigInteger(buffer.array());
    }
}

Related

  1. toArray(long length)
  2. toASCII(String str)
  3. toAsciiBytes(String s)
  4. toASCIIString(URI u)
  5. toAttributeValue(Object value)
  6. toBigInteger(byte[] bytes)
  7. toBinaryFloatingPoint(double source)
  8. toBinaryString(byte[] b)
  9. toBuffer(boolean[] src, int offset)