只需要列举出四位的格雷码就能发现规律; import java.util.*; public class GrayCode { public String[] getGray(int n) { String[] s = new String[(int) Math.pow(2,n)]; ...