code: public static ModifiableHyperBoundingBox intersection(final SpatialComparable box1, final SpatialComparable box2) {
      final int dim = assertSameDimensionality(box1, box2);
  
      double[] min = new double[dim];
      double[] max = new double[dim];
  
      for(int i = 0; i < dim; i++) {
        min[i] = Math.max(box1.getMin(i), box2.getMin(i));
        max[i] = Math.min(box1.getMax(i), box2.getMax(i));
        if(min[i] > max[i]) {
          return null;
        }
      }
      return new ModifiableHyperBoundingBox(min, max);
    }
docs: Calculate the intersection of the two MBRs or <code>null</code> if they do
  not intersect. <em>Note</em>: if the given MBRs intersect in only one point
  of any dimension, this method still returns a result!
  
  @param box1 the first MBR
  @param box2 the second MBR
  @return the union of the two specified MBRs