GeoTools : Create MathTransforms

Create a MathTransform from source and target CRS's:

import org.opengis.referencing.operation.CoordinateOperationFactory;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.CoordinateOperation;

import org.geotools.referencing.FactoryFinder;

...

CoordinateOperationFactory coFactory = FactoryFinder.getCoordinateOperationFactory();

CoordinateReferenceSystem sourceCRS = ...
CoordinateReferenceSystem targetCRS = ...

CoordinateOperation op = coFactory.createOperation(sourceCRS, targetCRS);
MathTransform trans = op.getMathTransform();

Creating a MathTransform by hand:

import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.parameter.ParameterValueGroup;

import org.geotools.referencing.FactoryFinder;

...

MathTransformFactory mtFactory = FactoryFinder.getMathTransformFactory();
ParameterValueGroup params = mtFactory.getDefaultParameters("Hotine_Oblique_Mercator");
params.parameter("semi_major").setValue(6377298.556);
params.parameter("semi_minor").setValue(6356097.5503009);
params.parameter("longitude_of_center").setValue(115.0);
params.parameter("latitude_of_center").setValue(4.0);
params.parameter("azimuth").setValue(53.315820472222200);
params.parameter("rectified_grid_angle").setValue(53.130102361111100);
params.parameter("scale_factor").setValue(0.99984);
params.parameter("false_easting").setValue(0.0);
params.parameter("false_northing").setValue(0.0);
MathTransform trans = mtFactory.createParameterizedTransform(params);