Java BigDecimal to convertHoursToMillis(BigDecimal hours)

Here you can find the source of convertHoursToMillis(BigDecimal hours)

Description

Number of hours = # of hours * 60 seconds * 60 minutes * 1000 millis

License

Apache License

Parameter

Parameter Description
hours a parameter

Return

hours converted to milliseconds

Declaration

private static BigDecimal convertHoursToMillis(BigDecimal hours) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    /**/*www.  j a  v a2  s .  c o  m*/
     * Number of hours = # of hours * 60 seconds * 60 minutes * 1000 millis
     * @param hours
     * @return hours converted to milliseconds
     */
    private static BigDecimal convertHoursToMillis(BigDecimal hours) {
        return hours.multiply(convertMinutesToMillis(new BigDecimal(60)));
    }

    /**
     * Number of minutes = # of minutes * 60 seconds * 1000 millis
     * @param minutes
     * @return minutes converted to milliseconds
     */
    private static BigDecimal convertMinutesToMillis(BigDecimal minutes) {
        return minutes.multiply(convertSecondsToMillis(new BigDecimal(60)));
    }

    /**
     * Number of second = # of seconds *  1000 millis
     * @param seconds
     * @return seconds converted to milliseconds
     */
    private static BigDecimal convertSecondsToMillis(BigDecimal seconds) {
        return seconds.multiply(new BigDecimal(1000));
    }
}

Related

  1. convertBigDecimalToSQLBigNum(BigDecimal bd, int targetLength, int targetScale)
  2. convertBigDecimalToString(BigDecimal bigValue)
  3. convertDoubleToBigDecimal(Double value)
  4. convertDoubleToBigDecimal(final Double score, final int decimalPlaces)
  5. convertFeetToInches(BigDecimal feet)
  6. convertNullToBigDecimal(Object orgStr)
  7. convertRadiansToDegrees(BigDecimal radians)
  8. convertRating(BigDecimal rating)
  9. convertSecondsToMillis(BigDecimal seconds)