/**
* @author Administrator
*
*/
public class MultiplicationTable {
/**
* 递归算法
*/
public void MultiplicationPrint(){
for(int i = 1; i < 10; i++){
for(int j = 1; j <= i; j++){
System.out.print(j + "*" + i +"=" + i * j + "\t\t");
}
System.out.println();
}
}
/**
* 冒泡算法
*/
public static void BubbleSort(){
int[] arr = new int[]{63, 4, 24, 1, 3, 13};
System.out.println("冒泡排序的过程:");
for(int i = 1; i < arr.length; i++){
for(int j = 0; j < arr.length - 1; j++){ //原理:始终比较相邻的两个数字
if(arr[j] > arr[j+1]){
int tmp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = tmp;
}
System.out.print(arr[j] + " ");
}
System.out.print("【");
for(int j = arr.length - i; j < arr.length; j++){
System.out.print(arr[j] + " ");
}
System.out.println("】");
}
}
}
转载于:https://my.oschina.net/leet123/blog/643899