数组中只出现一次的数字

一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。
思路:使用两个循环
public class Solution {
    public void FindNumsAppearOnce(int [] array,int num1[] , int num2[]) {
        int count = 0;
        int[]a={0,0};
        int index = 0;
        for(int i = 0;i<array.length;i++){
            for(int j = 0;j<array.length;j++){
                if(array[i] == array[j]){
                    count++;
                }
            }
            if(count == 1){
                a[index++]=array[i];
            }
            count = 0;
        }
        num1[0] = a[0];
        num2[0] = a[1];
    }
}
原文地址:https://www.cnblogs.com/LoganChen/p/6489129.html