Here you can find the source of clampNumberFromTime(long ms, float seconds)
public static float clampNumberFromTime(long ms, float seconds)
//package com.java2s; //License from project: Open Source License public class Main { public static float clampNumberFromTime(long ms, float seconds) { float f = getNumberFromTime(ms, seconds); if (f >= 0.5f) { return 1f - f; } else/*from www .j a v a2s . c o m*/ return f; } public static float clampNumberFromTime(float sec) { return clampNumberFromTime(System.currentTimeMillis(), sec); } /** * get a number from 0, 1 based on time * * @return */ public static float getNumberFromTime() { return getNumberFromTime(System.currentTimeMillis(), 1); } public static float getNumberFromTime(float seconds) { return getNumberFromTime(System.currentTimeMillis(), seconds); } public static float getNumberFromTime(long time, float seconds) { if (seconds == 0) throw new IllegalArgumentException("Seconds cannot be zero!"); return ((time % Math.round((seconds * 1000))) / (seconds * 1000f)); } }