package com.mbc.text;
public class Gery {
public static String[] gery(int m)
{
String [] gery=new String [(int)Math.pow(2, m)];
if(m==1)
{
gery[0]="0";
gery[1]="1";
return gery;
}
String [] last=gery(m-1);
for(int i=0;i<last.length;i++)
{
gery[i]="0"+last[i];
gery[gery.length-1-i]="1"+last[i];
}
return gery;
}
public static void main(String[] args) {
int n=4;
String[] res=gery(n);
for(int i=0;i<res.length;i++)
{
System.out.println(res[i]);
}
}
}