private int binarySearch(int m, int start, int end, int factorial) {
        int i = 1;
        int j = end - start + 1;
        while (i <= j) {
            int middle = (i + j)/2;
            if (factorial*(middle) >= m && factorial*(middle - 1) < m) {
                return middle;
            } else if (factorial*middle < m){
                i = middle + 1;
            } else {
                j = middle - 1;
            }
        }
        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