public List<Integer> grayCode(int n) {
        List<Integer> result = new LinkedList<>();
        for (int i = 0; i < 1<<n; i++) {
            result.add(i ^ i>>1);
        }
        return result;
    }
Date 03/12/2016
@author Tushar Roy

Get first n gray code
Reference
https://leetcode.com/problems/gray-code/
src/com/interview/bits/GrayCode.java