GrayCode method2