1 /** 2 水仙花 3 */ 4 public class Demo{ 5 public static void main(String[] args){ 6 for(int i = 100 ; i <= 999 ; i++){ 7 int bai = i 100 % 10; 8 int shi = i 10 % 10; 9 int ge = i % 10; 10 if(i == bai*bai*bai + shi*shi*shi + ge*ge*ge); 11 System.out.println(i); 12 } 13 } 14 } 15 16 /** 17 冒泡排序 18 */ 19 public class Demo2{ 20 public static void main(String[] args){ 21 int[] arr = {4,2,5,3}; 22 for(int i = 0 ; i < arr.length ; i++){ 23 for(int j = 0 ; j < arr.length-i-1 ; j++){ 24 if(arr[j] > arr[j+1]){ 25 int temp = arr[j]; 26 arr[j] = arr[j+1]; 27 arr[j+1] = temp; 28 } 29 30 } System.out.println(arr[i]); 31 } 32 } 33 } 34