Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    /**
     * Take a universal time between 0 and 24 and return a triple
     * [hours, minutes, seconds].
     * 
     * @param ut Universal time - presumed to be between 0 and 24.
     * @return [hours, minutes, seconds]
     */
    public static int[] clockTimeFromHrs(double ut) {
        int[] hms = new int[3];
        hms[0] = (int) Math.floor(ut);
        double remainderMins = 60 * (ut - hms[0]);
        hms[1] = (int) Math.floor(remainderMins);
        hms[2] = (int) Math.floor(remainderMins - hms[1]);
        return hms;
    }
}