public void sample(int[] S, int sampleSize) {
        k = new int[sampleSize];
        if (k.length > S.length)
            return;
        if (S == null || S.length == 0)
            return;

        int i=0;
        for (i=0; i<k.length; i++)
            k[i] = S[i];

        for (int j=i; j<S.length; j++) {
            int random = getRandom(j-1);
            System.out.println("Random number " + random);
            if (random <= k.length) {
                k[random] = S[j];
            }
        }
    }