public class GetMaxWithoutBoolean {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(getMax(100, 20));
}
public static int getMax(int a ,int b){
int[] arr = new int[a];
try {
arr[b]=0;
} catch (Exception e) {
// TODO: handle exception
return b;
}
return a;
}
}
结果:
100