kelvin To Celsius - Java java.lang

Java examples for java.lang:Math Convert

Description

kelvin To Celsius

Demo Code


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

public class Main {
    public static double kelvinToCelsius(double temperature) {
        return scaleTemperature(temperature - 273.15);
    }//www  .j a v  a 2  s . c om

    public static double scaleTemperature(double value) {

        return new BigDecimal(value)
                .setScale(1, BigDecimal.ROUND_HALF_EVEN).intValue();
    }
}

Related Tutorials