// 冒泡求数组最小值 public class Bubble { // 定义存储最小值的变量 static int min; public static void main(String[] args) { int[] arr; arr = new int[]{10,200,66,1,0}; min = arr[0]; Bubble Max = new Bubble(); Max.getMin(arr,0); System.out.println("最小值 ===== "+min); } void getMin(int[] arr,int index){ if(index<arr.length){ if(index<arr.length-1){ compare(arr[index],arr[index+1]); } getMin(arr,index+1); }else{ return; } } static void compare(int one,int two){ if(one<two){ if(one<min){ min = one; } }else{ if(two<min){ min = two; } } } }