我想返回一个改变后的数组,但不知道怎么操作
public static int[] getArray(int[] arr) {
int count=0;
for (int i =0;i<arr.length ;i++ ) {
int units = arr[i]%10; //找到个位units
int decade = arr[i]/10%10; //找到十位decade
int hundred = arr[i]/100%10; //找到百位hundred
int kbps = arr[i]/1000; //找到千位kbps
int num = units+hundred;
int num2 = decade+kbps;
if(num==num2){
//我如何才能拿到arr[i]返回啊.
}
}
return arr;
}
|
|