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