You can calculate the area of a surface with one of these three methods:

In Program: Area calculation for a shapefile, we calculate and output the area of the elements of a shapefile.

Program: Area calculation for a shapefile
String countriesFile = "Data/Shp/NaturalEarth/50m_cultural/ne_50m_admin_0_countries_lakes.shp";
ILcdModel model = new TLcdSHPModelDecoder2().decode(countriesFile);
ILcdEllipsoid ellipsoid = ((ILcdGeodeticReference) model.getModelReference()).getGeodeticDatum().getEllipsoid();
Enumeration elements = model.elements();
while (elements.hasMoreElements()) {
  Object element = elements.nextElement();
  String countryName = (String) ((ILcdDataObject) element).getValue("ADMIN");
  double countryAreaSqM = TLcdEllipsoidUtil.geodesicArea((ILcdShape) element, ellipsoid);
  System.out.println(String.format("%s: %.2f km2", countryName, countryAreaSqM / 1e6));

See the API reference documentation for more details and limitations.

area calculation example
Figure 1. An example of the area of a complex polygon