timeutil.java
来自「JAVA在编译原理上的应用。」· Java 代码 · 共 27 行
JAVA
27 行
package lolo.test;import java.io.PrintStream;/** Used by all <tt>TypicalCompilerScannerBy...</tt> scanners to print a time in a human readable form. * * @author <a href="http://www.inf.uos.de/bernd" target="_blank">Bernd Kühl</a> (<a href="mailto:bernd@informatik.uni-osnabrueck.de">bernd@informatik.uni-osnabrueck.de</a>) */public class TimeUtil { /** Used by all <tt>TypicalCompilerScannerBy...</tt> scanners to print a time in a human readable form. * * @param message a messahe which is printed before the time is printed. * @param ms the time to print. * @param out all the ouput is written to this stream. */ public static void printMilliSecons(String message, long ms, PrintStream out) { out.print(message+ms+"/"); long hours = ms / 3600000; // 1000 * 60 * 60 is a hour ms %= 3600000; long minutes = ms / 60000; // 1000 * 60 is a minute ms %= 60000; long seconds = ms / 1000; // 1000 is a second ms %= 1000; out.println(hours+":"+minutes+":"+seconds+"."+ms); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?