code: private int computeOffset(int x, int y) {
      if(y > x) {
        return computeOffset(y, x);
      }
      return ((x * (x + 1)) >> 1) + y;
    }
docs: Compute the offset within the file.
  
  @param x First coordinate
  @param y Second coordinate
  @return Linear offset