// Set the line item to get a forecast for.
Long lineItemId = Long.parseLong("INSERT_LINE_ITEM_ID_HERE");
// Get forecast for line item.
Forecast forecast = forecastService.getForecastById(lineItemId);
// Display results.
long matched = forecast.getMatchedUnits();
double availablePercent = (forecast.getAvailableUnits() / (matched * 1.0)) * 100;
String unitType = forecast.getUnitType().toString().toLowerCase();
System.out.println(matched + " " + unitType + " matched.\n"
+ availablePercent + "% " + unitType + " available.");
if (forecast.getPossibleUnits() != null) {
double possiblePercent = (forecast.getPossibleUnits() / (matched * 1.0)) * 100;
System.out.println(possiblePercent + "% " + unitType + " possible.\n");
}
}