Java Second Get GetTimeFromSeconds(double time)

Here you can find the source of GetTimeFromSeconds(double time)

Description

Get Time From Seconds

License

Open Source License

Declaration

public static byte GetTimeFromSeconds(double time) 

Method Source Code

//package com.java2s;
/*//from   ww  w  .  j  a v  a  2  s  .c om
 *    AsTeRICS - Assistive Technology Rapid Integration and Construction Set
 * 
 * 
 *        d8888      88888888888       8888888b.  8888888 .d8888b.   .d8888b. 
 *       d88888          888           888   Y88b   888  d88P  Y88b d88P  Y88b
 *      d88P888          888           888    888   888  888    888 Y88b.     
 *     d88P 888 .d8888b  888   .d88b.  888   d88P   888  888         "Y888b.  
 *    d88P  888 88K      888  d8P  Y8b 8888888P"    888  888            "Y88b.
 *   d88P   888 "Y8888b. 888  88888888 888 T88b     888  888    888       "888
 *  d8888888888      X88 888  Y8b.     888  T88b    888  Y88b  d88P Y88b  d88P
 * d88P     888  88888P' 888   "Y8888  888   T88b 8888888 "Y8888P"   "Y8888P" 
 *
 *
 *                    homepage: http://www.asterics.org 
 *
 *         This project has been funded by the European Commission, 
 *                      Grant Agreement Number 247730
 *  
 *  
 *         Dual License: MIT or GPL v3.0 with "CLASSPATH" exception
 *         (please refer to the folder LICENSE)
 * 
 */

public class Main {
    public static byte GetTimeFromSeconds(double time) {
        double timeConstant = 0.25;
        int counter = 0;
        int value = 0;
        do {
            if ((value = (int) (time / timeConstant)) <= 15) {
                return (byte) (counter * 16 + value);
            }

            timeConstant = timeConstant * 2;
            counter++;
        } while (timeConstant < 2048);

        return 0x00; // Zeit nicht gefunden
    }
}

Related

  1. getSecondToLastIndexOf(String string, char character)
  2. getSecondVersion(String buildId)
  3. getSYNTimeSeconds()
  4. getTextBeforeFirstAndSecondColumns(String s)
  5. getTimeAsSeconds(String value)
  6. getTimeFromSeconds(int seconds)
  7. getTimeInSecondResolution(long timeMillis)
  8. getTimeSeconds(String time)
  9. getTimeStringFromSeconds(int totalSeconds)