code: public static String asMapArea(MapWidget map, double area) {
  		double unitLength = map.getUnitLength();
  		double distance = area * unitLength * unitLength;
  
  		String unit = "m";
  		if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.METRIC) {
  			// Right now, the distance is expressed in meter. Switch to km?
  			if (distance > (METERS_IN_KM * METERS_IN_KM)) {
  				distance /= (METERS_IN_KM * METERS_IN_KM);
  				unit = "km";
  			}
  		} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.ENGLISH) {
  			if (distance > (METERS_IN_MILE * METERS_IN_MILE)) {
  				// Switch to mile:
  				distance = distance / (METERS_IN_MILE * METERS_IN_MILE);
  				unit = "mi";
  			} else {
  				distance /= (METERS_IN_YARD * METERS_IN_YARD); // use yards.
  				unit = "yd";
  			}
  		} else if (map.getMapModel().getMapInfo().getDisplayUnitType() == UnitType.CRS) {
  			unit = "u";
  		}
  
  		String formatted = NumberFormat.getDecimalFormat().format(distance);
  		return formatted + unit + "&sup2;";
  	}
docs: Area formatting method. Requires an area as parameter, expressed in the CRS units of the given map.
  
  @param map
  The map for which an area should be formatted. This map may be configured to use the metric system or
  the English system.
  @param area
  The original area, expressed in the coordinate reference system of the given map.
  @return Returns a string that is the formatted area of the given area. Preference goes to meters or yards
  (depending on the configured unit type), but when the number is larger than meters (or yards), it will
  switch automatically to kilometers/miles.