code: public static double[] shiftContainer(IAtomContainer container, double[] bounds, double[] last, double gap) {
  
          assert bounds.length == 4;
          assert last.length == 4;
  
          final double boundsMinX = bounds[0];
          final double boundsMinY = bounds[1];
          final double boundsMaxX = bounds[2];
          final double boundsMaxY = bounds[3];
  
          final double lastMaxX = last[2];
  
          // determine if the containers are overlapping
          if (lastMaxX + gap >= boundsMinX) {
              double xShift = lastMaxX + gap - boundsMinX;
              Vector2d shift = new Vector2d(xShift, 0.0);
              GeometryUtil.translate2D(container, shift);
              return new double[]{boundsMinX + xShift, boundsMinY, boundsMaxX + xShift, boundsMaxY};
          } else {
              // the containers are not overlapping
              return bounds;
          }
      }
docs: Shift the container horizontally to the right to make its bounds not overlap with the other
  bounds. To avoid dependence on Java AWT, rectangles are described by arrays of double. Each
  rectangle is specified by {minX, minY, maxX, maxY}.
  
  @param container the {@link IAtomContainer} to shift to the
  right
  @param bounds    the bounds of the {@link IAtomContainer} to shift
  @param last      the bounds that is used as reference
  @param gap       the gap between the two rectangles
  @return the rectangle of the {@link IAtomContainer} after the shift