Java Celsius to Fahrenheit celsiusToFahrenheit(Double celsius)

Here you can find the source of celsiusToFahrenheit(Double celsius)

Description

Converts celsius to fahrenheit.

License

Open Source License

Declaration

public static Double celsiusToFahrenheit(Double celsius) 

Method Source Code

//package com.java2s;
/**//from   ww  w .ja v a2s  .c o  m
 * Copyright (c) 2010-2018 by the respective copyright holders.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

import java.math.BigDecimal;

public class Main {
    private static final BigDecimal ONE_POINT_EIGHT = new BigDecimal("1.8");
    private static final BigDecimal THIRTY_TWO = new BigDecimal("32");

    /**
     * Converts celsius to fahrenheit.
     */
    public static Double celsiusToFahrenheit(Double celsius) {
        return celsius == null ? null
                : new BigDecimal(celsius).multiply(ONE_POINT_EIGHT).add(THIRTY_TWO).doubleValue();
    }
}

Related

  1. celsiusToFahrenheit(Double celsius)
  2. celsiusToFahrenheit(double temperature)
  3. celsiusToFahrenheit(float celsius)
  4. celsiusToFahrenheit(float value)
  5. toFahrenheit(double c)