Java Number Convert convertToDecimal(Number n)

Here you can find the source of convertToDecimal(Number n)

Description

convert To Decimal

License

Open Source License

Declaration

private static BigDecimal convertToDecimal(Number n) 

Method Source Code

//package com.java2s;
// Clark & Parsia, LLC parts of this source code are available under the terms of the Affero General Public License v3.

import java.math.BigDecimal;

public class Main {
    private static BigDecimal convertToDecimal(Number n) {
        if (n instanceof BigDecimal)
            return (BigDecimal) n;
        else// w  ww  . j ava 2 s  .  c  o  m
            return new BigDecimal(n.toString());
    }
}

Related

  1. convertSize(Long size)
  2. convertSizeG1DetailsToSizeG1(final String size, final char units)
  3. convertSizeToMB(long sizeInBytes)
  4. convertsToLong(double v)
  5. convertStringToObjectWrapper(String className, String value)
  6. convertToHours(long workingDuration)
  7. convertToInchesOfMercury(double altimeterSetting, String unit)
  8. convertToJBPM(Object value)
  9. convertToKg(int value)