public boolean skyFall(Orb[][] arr) {
      boolean flag = false;
      // Y-2 because there are no gaps beneath
      for (int i = Y - 1; i >= 0; i--) {
         for (int j = 0; j < X; j++) {
            if (arr[i][j] == null) {// there is a gap - but it doesn't have to
                                    // be on top or bottom

               int depth, height;
               for (depth = 0; depth + i < Y; depth++) {// finds where to end
                  if (arr[i + depth][j] != null)// there's something underneath
                     break;
               }
               for (height = 0; i - height >= 0; height++) {
                  if (arr[i - height][j] != null)// there could be gaps on top
                                                 // too
                     break;
               }
               // now move everything above it down
               int h = 0;
               while ((i - h - height) >= 0) {
                  if (!flag)
                     flag = true;
                  swap(i - h + depth - 1, j, i - h - height, j, arr);
                  h++;
               }
            }
         }
      }
      return flag;
   }