java入门练习题二

练习一:找出101-200之间的所有素数

package com.pratice.daily;

public class Sushu {
	public static void main(String[] args) {		
		for(int i=101;i<=200;i++){
			int j=2;
			while(j=i) System.out.print(i+" ");
		}
	}
}

练习二:排序算法

package com.pratice.daily;

public class Sort {
	public static void popSort(int[] b){
		int n = b.length;
		int countTimes = 0; //count time
		for(int i=0;ib[j+1]) {					
					int temp = b[j+1];
					b[j+1]=b[j];
					b[j]=temp;
				}				
			}	
			n--; //reduce count time
		}
		for(int i=0;i


你可能感兴趣的:(java入门)