private void fillupRemaining(int result[], boolean used[], int index) {
        int j = 0;
        for(int i = index; i < result.length; i++) {
            while (true) {
                if (!used[j]) {
                    result[i] = j + 1;
                    used[j] = true;
                    break;
                }
                j++;
            }
        }
    }
@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