• + 0 comments

    This one is very good but, for the case when k is much more bigger than n it is not working, because an arrayoutofboundException will occure.

    maybe this will help

        if (m-k%n < 0) {
            posValue = m-k%n+n;
        }
        else posValue = m-k%n;
        System.out.println(a[posValue]);