long firstGroup = 10; long divider = 100000000; while ((number - (firstGroup * divider)) > divider){ firstGroup++; }