How to use jGridShift
GridShiftFile is the central class of jGridShift. A GridShiftFile object must be instantiated and loaded with Sub Grid data from a binary Grid Shift File before coordinates may be transformed. Data may be loaded from a RandomAccessFile or an InputStream. The InputStream option offers higher transformation performance at the cost of a higher memory footprint (the node data is stored in Java arrays). The RandomAccessFile option has a small memory footprint because it reads the file for each transformation.
GridShiftFile gsf = new GridShiftFile();
RandomAccessFile gsb = new RandomAccessFile("NTV2_0.GSB","r");
A GridShift value object must be instantiated to hold the coordinate to be transformed, and the shift data that will be calculated.
GridShift gs = new GridShift();
Getters and setters are available for decimal degrees (using Positive East Longitude) and decimal seconds (using Positive West Longitude).

Now transform the coordinate and use the shifted values. Accuracy data is available if loaded from a RandomAccessFile, or from an InputStream with the 'loadAccuracy' flag set true. Accuracy data is available as degrees, seconds or metres. Longitude accuracy in metres takes the latitude into account.

boolean withinGrid = gsf.gridShiftForward(gs);
if (withinGrid) {
    System.out.println("Lat: " + gs.getShiftedLatDegrees());
    System.out.println("Lon: " + gs.getShiftedLonPositiveEastDegrees());
    if (gs.isLatAccuracyAvailable()) {
        System.out.println("Lat Accuracy: " + gs.getLatAccuracyMetres());
All data is stored internally as Positive West Seconds (because the NTv2 file uses PWS). Coordinate values may be set and retrieved in different units, as the getters and setters convert to PWS.