private int nthUnused(boolean used[], int n) {
        int unused = 0;
        for ( int i = 0; i < used.length; i++) {
            if (!used[i]) {
                unused++;
                if (unused == n) {
                    return i;
                }
            }
        }
        throw new IllegalArgumentException();
    }
@author Tushar Roy
Date 01/21/2016

Given a number n, find mth value in permutation of array consisting of [1..n] values.
mth is defined by lexicographical order.
src/com/interview/number/MthNumberInNSizeArray.java