public class PlusTest {
public static void main(String[] args) {
int[] arr = {1,2,3,4,5,6,2,7,8,9,0,3,4,8,1};
Plus.same(arr);
Plus.lose(arr);
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}
/**
*这是求相同的数
* @param arr
*/
public static void same(int[] arr) {
for (int x = 0; x < arr.length; x++) {
for (int i = (x + 1); i < arr.length; i++) {
if (arr[x] == arr[i]) {
System.out.println(arr[i]);
}
}
}
} |
|