Java 时间范围 Util
import java.util.Date;
public class TimeSpan
{
public final static TimeSpan ZERO = new TimeSpan(0);
private long _totalMilliSeconds = 0;
public TimeSpan(long totalMilliSeconds)
{
_totalMilliSeconds = totalMilliSeconds;
}
public TimeSpan(Date afterDate, Date beforeDate)
{
this(afterDate.getTime() - beforeDate.getTime());
}
public long getMilliSeconds()
{
return _totalMilliSeconds;
}
public long getSeconds()
{
return Math.round(_totalMilliSeconds/1000);
}
public long getMinutes()
{
return Math.round(_totalMilliSeconds/(1000*60));
}
public long getHours()
{
return Math.round(_totalMilliSeconds/(1000*60*60));
}
}
相关文档:
@echo off cls REM --- BEG MACHINE-DEPENDENT ---- set HOME_J2RE=C:\Program Files\Java\jdk1.5.0_17 REM --- END MACHINE-DEPENDENT ---- set HOME_JAVA=%HOME_J2RE%\bin\java set HOME_JAVA="%HOME_JAVA%" set ARG_MEMORY=-Xms128m -Xmx196m set PROP_POLICY=-Dorg.ragingcat.kst.uikeytool.policy.extende ......
// 创建Excel
String destFileName = tableName + ".xls";//文件名
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=".concat(String .valueOf(destFileNa ......
Java 定义的位运算(bitwise operators )直接对整数类型的位进行操作,这些整数类型包括long,int,short,char,and byte 。表4-2 列出了位运算:
表4.2 位运算符及其结果
运算符 &nb ......
JAVA虚拟机有一个字符串池,对于字符串池的访问可以使用字符串对象的intern()方法,可动态向池中添加对象,它的定义如下:
public native String intern();
这是一个本地方法,在调用这个方法时,JAVA虚拟机首先检查字符串池中是否存在与该字符串对象值相等的对象,如果存在就返回字符串池中的对象的引用,否则就新创建一个 ......
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
public class ThreadLog
{
private final static String _detailLogFile = "log"+File.separator+"detail";
private static boolean _logFlag = true;
priv ......