code: public static double[] createBoundingBox(double[] coordinates) {
          int maxActualCoords = Math.min(coordinates.length,3);// ignore potential M values, so 4 dimension (X Y Z M) becomes X Y Z
          double[] result = new double[maxActualCoords * 2];
          for (int i = 0; i < maxActualCoords; i++) {
              result[i] = coordinates[i];
              result[maxActualCoords + i] = coordinates[i];
          }
          return result;
      }
docs: Creates a boundingbox for a point. In this case, both the lower and higher edges of the bbox are the point
  itself
  
  @param coordinates the coordinates of the point
  @return the boundingbox, a list with doubles. the result is a 2*n array where n is the number of dimensions
  represented in the input, with the lowest values for all axes followed by the highest values.