static void findSum2(int[] array) {
        Arrays.sort(array);
        int length = array.length;
        int half = length/2;
        for (int i=0, j=length-1; i<half&&j>half; ) {   // be careful of this line
            if (array[i] + array[j] == 10) {
                System.out.println("pair:" + array[i] + "and" + array[j]);
                i++; j--;
            } else
            if (array[i] + array[j] > 10) {
                j--;
            } else
            if (array[i] +array[j] < 10) {
                i++;
            }
        }
    }