Simply put
for (int i = 0; i < 1 << Level; i++) { ... }
equally
for (int i = 0; i < Math.pow(2,Level); i++) { ... }
Thus, the for loop will work for "Math.pow (2, Level)" times, since you are calculating from 0 to Math.pow (2, Level) -1.
if Level = 2, then the cycle
for(int i =0;i<4;i++){}
if Level = 3, then the cycle
for(int i =0;i<8;i++){}
if Level = 5, then the cycle
for(int i =0;i<32;i++){}
source share