code: public static Polygon[] buffer(Geometry[] geometries,
  			SpatialReference spatialReference, double[] distances,
  			boolean toUnionResults) {
  		// initially assume distances are in unit of spatial reference
  		double[] bufferDistances = distances;
  
  		OperatorBuffer op = (OperatorBuffer) factory
  				.getOperator(Operator.Type.Buffer);
  
  		if (toUnionResults) {
  			SimpleGeometryCursor inputGeometriesCursor = new SimpleGeometryCursor(
  					geometries);
  			GeometryCursor result = op.execute(inputGeometriesCursor,
  					spatialReference, bufferDistances, toUnionResults, null);
  
  			ArrayList<Polygon> resultGeoms = new ArrayList<Polygon>();
  			Geometry g;
  			while ((g = result.next()) != null) {
  				resultGeoms.add((Polygon) g);
  			}
  			Polygon[] buffers = resultGeoms.toArray(new Polygon[0]);
  			return buffers;
  		} else {
  			Polygon[] buffers = new Polygon[geometries.length];
  			for (int i = 0; i < geometries.length; i++) {
  				buffers[i] = (Polygon) op.execute(geometries[i],
  						spatialReference, bufferDistances[i], null);
  			}
  			return buffers;
  		}
  	}
docs: Calculates a buffer polygon for each geometry at each of the
  corresponding specified distances.  It is assumed that all geometries have
  the same spatial reference. There is an option to union the
  returned geometries.
  
  See OperatorBuffer.
  
  @param geometries An array of geometries to be buffered.
  @param spatialReference The spatial reference of the geometries.
  @param distances The corresponding distances for the input geometries to be buffered.
  @param toUnionResults TRUE if all geometries buffered at a given distance are to be unioned into a single polygon.
  @return The buffer of the geometries.