Java Time Convert to timeToExactString(double d)

Here you can find the source of timeToExactString(double d)

Description

time To Exact String

License

Open Source License

Declaration

public static String timeToExactString(double d) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /** A constant indicating that there is no valid data. */
    public static final double NO_DATA_D = Double.NEGATIVE_INFINITY;

    public static String timeToExactString(double d) {
        if (d == NO_DATA_D) {
            return "No Data";

        } else {// w w w  .ja v  a  2 s .c o m
            int minutes = ((int) d) / 60;
            int seconds = ((int) d) - (minutes * 60);
            int hundreds = (int) ((d - ((int) d)) * 100.0);
            String result = String.valueOf(minutes) + ":";
            if (seconds < 10) {
                result += "0";
            }
            result += String.valueOf(seconds) + ".";
            if (hundreds < 10) {
                result += "0";
            }
            result += String.valueOf(hundreds);

            return result;
            //return FORMAT.format(d);
        }
    }
}

Related

  1. timeToDouble(Object value)
  2. timeToDriveDistanceDeadReckoning(double distance, double robotMaxSpeed, double targetSpeed)
  3. timeToFloat(String aTimeDuration)
  4. timeToFromNow(long time)
  5. timeToIndex(String twentyFourHourTime)
  6. timeToInt(final String time)