Package com.pi4j.temperature
Class TemperatureConversion
- java.lang.Object
-
- com.pi4j.temperature.TemperatureConversion
-
public class TemperatureConversion extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static double
ABSOLUTE_ZERO_CELSIUS
static double
ABSOLUTE_ZERO_FARENHEIT
static double
ABSOLUTE_ZERO_KELVIN
static double
ABSOLUTE_ZERO_RANKINE
-
Constructor Summary
Constructors Constructor Description TemperatureConversion()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
convert(TemperatureScale from, TemperatureScale to, double temperature)
Convert a temperature value from one temperature scale to another.static double
convertCelsiusToFarenheit(double temperature)
Convert temperature from Celsius to Farenheit temperature scale FORMULA = [°F] = [°C] × 9/5 + 32static double
convertCelsiusToKelvin(double temperature)
Convert temperature from Celsius to Kelvin temperature scale FORMULA = [K] = [°C] + 273.15static double
convertCelsiusToRankine(double temperature)
Convert temperature from Celsius to Rankine temperature scale FORMULA = [°R] = ([°C] + 273.15) × 9/5static double
convertFarenheitToCelsius(double temperature)
Convert temperature from Farenheit to Celsius temperature scale FORMULA = [°C] = ([°F] − 32) × 5/9static double
convertFarenheitToKelvin(double temperature)
Convert temperature from Farenheit to Kelvin temperature scale FORMULA = [K] = ([°F] + 459.67) × 5/9static double
convertFarenheitToRankine(double temperature)
Convert temperature from Farenheit to Rankine temperature scale FORMULA = [°R] = [°F] + 459.67static double
convertFromCelsius(TemperatureScale to, double temperature)
Convert a temperature value from the Celsius temperature scale to another.static double
convertFromFarenheit(TemperatureScale to, double temperature)
Convert a temperature value from the Farenheit temperature scale to another.static double
convertFromKelvin(TemperatureScale to, double temperature)
Convert a temperature value from the Kelvin temperature scale to another.static double
convertFromRankine(TemperatureScale to, double temperature)
Convert a temperature value from the Rankine temperature scale to another.static double
convertKelvinToCelsius(double temperature)
Convert temperature from Kelvin to Celsius temperature scale FORMULA = [°C] = [K] − 273.15static double
convertKelvinToFarenheit(double temperature)
Convert temperature from Kelvin to Farenheit temperature scale FORMULA = [°F] = [K] × 9/5 − 459.67static double
convertKelvinToRankine(double temperature)
Convert temperature from Kelvin to Rankine temperature scale FORMULA = [°R] = [K] × 9/5static double
convertRankineToCelsius(double temperature)
Convert temperature from Rankine to Celsius temperature scale FORMULA = [°C] = ([°R] − 491.67) × 5/9static double
convertRankineToFarenheit(double temperature)
Convert temperature from Rankine to Farenheit temperature scale FORMULA = [°F] = [°R] − 459.67static double
convertRankineToKelvin(double temperature)
Convert temperature from Rankine to Kelvin temperature scale FORMULA = [K] = [°R] × 5/9static double
convertToCelsius(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Celsius temperature scale.static double
convertToFarenheit(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Farenheit temperature scale.static double
convertToKelvin(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Kelvin temperature scale.static double
convertToRankine(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Rankine temperature scale.
-
-
-
Field Detail
-
ABSOLUTE_ZERO_CELSIUS
public static final double ABSOLUTE_ZERO_CELSIUS
- See Also:
- Constant Field Values
-
ABSOLUTE_ZERO_FARENHEIT
public static final double ABSOLUTE_ZERO_FARENHEIT
- See Also:
- Constant Field Values
-
ABSOLUTE_ZERO_KELVIN
public static final double ABSOLUTE_ZERO_KELVIN
- See Also:
- Constant Field Values
-
ABSOLUTE_ZERO_RANKINE
public static final double ABSOLUTE_ZERO_RANKINE
- See Also:
- Constant Field Values
-
-
Method Detail
-
convert
public static double convert(TemperatureScale from, TemperatureScale to, double temperature)
Convert a temperature value from one temperature scale to another.- Parameters:
from
- TemperatureScaleto
- TemperatureScaletemperature
- value- Returns:
- converted temperature value in the requested to scale
-
convertFromFarenheit
public static double convertFromFarenheit(TemperatureScale to, double temperature)
Convert a temperature value from the Farenheit temperature scale to another.- Parameters:
to
- TemperatureScaletemperature
- value in degrees Farenheit- Returns:
- converted temperature value in the requested to scale
-
convertToFarenheit
public static double convertToFarenheit(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Farenheit temperature scale.- Parameters:
from
- TemperatureScaletemperature
- value from other scale- Returns:
- converted temperature value in degrees Farenheit
-
convertFromCelsius
public static double convertFromCelsius(TemperatureScale to, double temperature)
Convert a temperature value from the Celsius temperature scale to another.- Parameters:
to
- TemperatureScaletemperature
- value in degrees centigrade- Returns:
- converted temperature value in the requested to scale
-
convertToCelsius
public static double convertToCelsius(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Celsius temperature scale.- Parameters:
from
- TemperatureScaletemperature
- value from other scale- Returns:
- converted temperature value in degrees centigrade
-
convertFromKelvin
public static double convertFromKelvin(TemperatureScale to, double temperature)
Convert a temperature value from the Kelvin temperature scale to another.- Parameters:
to
- TemperatureScaletemperature
- value in Kelvin- Returns:
- converted temperature value in the requested to scale
-
convertToKelvin
public static double convertToKelvin(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Kelvin temperature scale.- Parameters:
from
- TemperatureScaletemperature
- value from other scale- Returns:
- converted temperature value in Kelvin
-
convertFromRankine
public static double convertFromRankine(TemperatureScale to, double temperature)
Convert a temperature value from the Rankine temperature scale to another.- Parameters:
to
- TemperatureScaletemperature
- value in degrees Rankine- Returns:
- converted temperature value in the requested to scale
-
convertToRankine
public static double convertToRankine(TemperatureScale from, double temperature)
Convert a temperature value from another temperature scale into the Rankine temperature scale.- Parameters:
from
- TemperatureScaletemperature
- value from other scale- Returns:
- converted temperature value in degrees Rankine
-
convertFarenheitToCelsius
public static double convertFarenheitToCelsius(double temperature)
Convert temperature from Farenheit to Celsius temperature scale FORMULA = [°C] = ([°F] − 32) × 5/9- Parameters:
temperature
- value in degrees Farenheit- Returns:
- converted temperature value in degrees Celsius
-
convertFarenheitToKelvin
public static double convertFarenheitToKelvin(double temperature)
Convert temperature from Farenheit to Kelvin temperature scale FORMULA = [K] = ([°F] + 459.67) × 5/9- Parameters:
temperature
- value in degrees Farenheit- Returns:
- converted temperature value in degrees Kelvin
-
convertFarenheitToRankine
public static double convertFarenheitToRankine(double temperature)
Convert temperature from Farenheit to Rankine temperature scale FORMULA = [°R] = [°F] + 459.67- Parameters:
temperature
- value in degrees Farenheit- Returns:
- converted temperature value in degrees Rankine
-
convertCelsiusToFarenheit
public static double convertCelsiusToFarenheit(double temperature)
Convert temperature from Celsius to Farenheit temperature scale FORMULA = [°F] = [°C] × 9/5 + 32- Parameters:
temperature
- value in degrees Celsius- Returns:
- converted temperature value in degrees Farenheit
-
convertCelsiusToKelvin
public static double convertCelsiusToKelvin(double temperature)
Convert temperature from Celsius to Kelvin temperature scale FORMULA = [K] = [°C] + 273.15- Parameters:
temperature
- value in degrees Celsius- Returns:
- converted temperature value in degrees Kelvin
-
convertCelsiusToRankine
public static double convertCelsiusToRankine(double temperature)
Convert temperature from Celsius to Rankine temperature scale FORMULA = [°R] = ([°C] + 273.15) × 9/5- Parameters:
temperature
- value in degrees Celsius- Returns:
- converted temperature value in degrees Rankine
-
convertKelvinToCelsius
public static double convertKelvinToCelsius(double temperature)
Convert temperature from Kelvin to Celsius temperature scale FORMULA = [°C] = [K] − 273.15- Parameters:
temperature
- value in degrees Kelvin- Returns:
- converted temperature value in degrees Celsius
-
convertKelvinToFarenheit
public static double convertKelvinToFarenheit(double temperature)
Convert temperature from Kelvin to Farenheit temperature scale FORMULA = [°F] = [K] × 9/5 − 459.67- Parameters:
temperature
- value in degrees Kelvin- Returns:
- converted temperature value in degrees Farenheit
-
convertKelvinToRankine
public static double convertKelvinToRankine(double temperature)
Convert temperature from Kelvin to Rankine temperature scale FORMULA = [°R] = [K] × 9/5- Parameters:
temperature
- value in degrees Kelvin- Returns:
- converted temperature value in degrees Rankine
-
convertRankineToFarenheit
public static double convertRankineToFarenheit(double temperature)
Convert temperature from Rankine to Farenheit temperature scale FORMULA = [°F] = [°R] − 459.67- Parameters:
temperature
- value in degrees Rankine- Returns:
- converted temperature value in degrees Farenheit
-
convertRankineToCelsius
public static double convertRankineToCelsius(double temperature)
Convert temperature from Rankine to Celsius temperature scale FORMULA = [°C] = ([°R] − 491.67) × 5/9- Parameters:
temperature
- value in degrees Rankine- Returns:
- converted temperature value in degrees Celsius
-
convertRankineToKelvin
public static double convertRankineToKelvin(double temperature)
Convert temperature from Rankine to Kelvin temperature scale FORMULA = [K] = [°R] × 5/9- Parameters:
temperature
- value in degrees Rankine- Returns:
- converted temperature value in degrees Kelvin
-
-