JavaÖеÄʱ¼ä¾«¶È
ÔÚJavaÖпÉÒÔͨ¹ýSystem.currentTimeMillis()»òÕßSystem.nanoTime() (JDK>=5.0) ·½·¨»ñµÃµ±Ç°µÄʱ¼äµÄ¾«È·Öµ¡£µ«ÊÇͨ¹ýÔĶÁJavadoc£¬ÎÒÃÇ·¢ÏÖÕâÁ½¸ö·½·¨²¢²»Ò»¶¨±£Ö¤µÃµ½ÄãËùÆÚÍûµÄ¾«¶È¡£ÏÈÀ´¿´System.currentTimeMillis()£º
Returns the current time in milliseconds. Note that while the unit of time of
the return value is a millisecond, the granularity of the value depends on the
underlying operating system and may be larger. For example, many operating
systems measure time in units of tens of milliseconds.
³ÏÈçÉÏÃæËù˵·µ»ØÖµµÄÁ£¶ÈÒÀÀµÓڵײã²Ù×÷ϵͳ£¬ÄÇôËüÔÚ²»Í¬µÄƽ̨Éϵ½µ×ÄÜÌṩÊÇôÑùµÄ¾«¶È£¬ÊÇ·ñÏñº¯ÊýÃûËùдµÄÄÇÑùÕæÕý
¾«
È·µ½1ºÁÃëÄØ£¿¿´ÏÂÃæÒ»¶Î²âÊÔ³ÌÐò£º
public class ClockAccuracyTest {
public static void main(String args[]) {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss:SSS");
int size = 4000000;
// create an array to hold millisecond times
// and loop to capture them
long times[] = new long[size];
for (int i = 0; i < size; i++) {
times[i] = System.currentTimeMillis();
}
// now display the unique times
long time = times[0];
long previousTime = times[0];
long count = 0;
Set<Long> deltas = new HashSet<Long>();
long delta = 0;
long minDelta = Long.MAX_VALUE;
long maxDelta = Long.MIN_VALUE;
&
Ïà¹ØÎĵµ£º
//µ÷Óô洢¹ý³Ì´ø²Î
CallableStatement ca = conn.prepareCall("{call Login (?,?)}");
ca.setString(1,username);
& ......
Ò»¡¢JavaÔËÐÐʱµÄÁ½ÖÖºËÐÄ»úÖÆ
£¨1£©JavaÐéÄâ»ú£¨Java Virtual Machine£©
ÓÃÀ´´¦ÀíJavaÔ´Îļþ±àÒëºóµÄ×Ö½ÚÂ룬ÆÁ±Îµ×²ãÔËÐÐÆ½Ì¨µÄ²îÒ죬ʵÏÖ“Ò»´Î±àÒë£¬Ëæ´¦Ö´ÐД£¬¶øÇÒ²»Í¬µÄÔËÐÐÆ ......
public class DateTest {
public static void main(String[] args) {
Date date = new Date(); // н¨Ò»¸öÈÕÆÚ
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // ¸ñʽ»¯ÈÕÆÚ
String beforeDate = sdf.format(getDateBefore(date, 10));
System ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ1ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
¶þ¡¢¿Î³ÌÄÚÈÝÓ뿼ºËÄ¿±ê
µÚ1Õ JavaÓïÑÔ»ù´¡
(Ò»)¿Î³ÌÄÚÈÝ
1.1 JavaÓïÑÔµÄÌØµã
1.2 JavaÓ¦ÓóÌÐòºÍСӦÓóÌÐò
1.3 Java³ÌÐòµÄ¿ª·¢¹ý³Ì
1.4±êʶ·ûºÍ¹Ø¼ü×Ö
l.5»ù±¾Êý¾ÝÀàÐÍ
1.5.1 Âß¼ÀàÐÍ
1 ......