Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaʵÏÖµÄÑ¡ÔñÅÅÐò

ÏÂÃæÊÇÓÃjavaʵÏÖµÄÑ¡ÔñÅÅÐò£¬Ã¿´Î´ÓÊý×éÖÐÑ¡È¡×îСµÄÖµ£º
import java.util.Date;
import java.util.Random;
/*
* Ñ¡ÔñÅÅÐò
*/
public class SelectSort {
public static void main(String args[])
{
int len = 40;
Date date = new Date();
Random random = new Random(date.getSeconds());
int data[]=new int[len];
for(int i = 0; i < len; i++)
{
data[i]=(int)(random.nextFloat()*100+1);
}
System.out.println("Select sort:");
show(data);
selectSort(data);
show(data);
}

private static void selectSort(int[] data)
{
int length = data.length;
for(int i=0; i<length-1; i++)
{
int temp = data[i];
for(int j=i+1; j<length; j++)
{
if(data[j] < temp )
{
data[i] = data[j];
data[j] = temp;
temp = data[i];
}
}
data[i]=temp;

}
}

private static void show(int[] data)
{
System.out.println("========================");
for(int i = 0; i < data.length; i++)
{
System.out.print(data[i] + " ");
}
System.out.println();
System.out.println("========================");
}
}


Ïà¹ØÎĵµ£º

Java SE ½Ó¿Ú¡¢³éÏóÀà

package demo;
interface Runner{
 int ID=1;
 void run();
 void fly();
}
abstract class AI implements Runner{
 public void run(){
  System.out.println("I am running");
 }
 public void bb(int x,int y){
  System.out.println((x+y));
 }
& ......

Java SE ¶àÏß³Ì

package thread;
class TestThread extends Thread {
 public void run(){
  while(true){
   System.out.println(Thread.currentThread().getName());
  }
 }
}
public class ThreadDemo {
 /**
  * @param args
  */
 public static void ......

JavaÖÐʹÓÃBigDecimalʵÏÖ¾«È·ÉáÎåÈë¼°¹¤³ÌÔËËã

£¨×¢£ºÇ°ÃæдÁËÒ»¸ö³¬´óÕûÊýÏà¼ÓµÄÀ࣬²Î¼û£º ³¬´óÕûÊýÏà¼Ó£¬³¬¹ýÁËlongµÄ·¶Î§£¬ÄãÒªÔõô×ö£¡£¬ºóÀ´ÓÐÅóÓÑÆÀÂÛ˵BigDecimal¿ÉÒÔÍêȫʵÏÖÎÒµÄÕâÕâ¸ö¹¦ÄÜ£¬¸Õ¿ªÊ¼µÄʱºò£¬ÎÒ»¹²»·þÆø£¬¾ÝÎÒËùÖªÄÇÀïÓÐÕâÑùµÄÀàŶ£¬ºóÀ´±¨×Å˵·þËûµÄÐÄÀíÈ¥ÕÒÁËһϣ¬ºÇºÇ£¬½á¹û¾ÓÈ»×Ô¼º±»Ëµ·þÁË£¬È·ÊµÓÐÕâôһ»ØÊ£¬ÀûÓÃBigDecimal²Ù×÷³¬´óÕûÊýÒ ......

java GBת UTF 8×Ö·û

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class GB2UTF
{
 public static String GBK2Unicode(String str)
 {
  StringBuffer result = new StringBuffer();
  for (int i = 0; i < str.length(); i++)
 &n ......

Java SE ¶àÏß³Ì Ïß³ÌÉúÃüÖÜÆÚ

package thread;
class ThreadTest4 implements Runnable{
 private boolean flag=true;
 public void stopMe(){
  flag=false;
 }
 public void run() {
  while (flag){
   System.out.println(Thread.currentThread().getName()+" is running ");
&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ