Because STK Components was originally developed for the .NET Framework, some subsystems require the use of out parameters. Since this language feature is not available in Java, we use single-element arrays to to achieve the same effect.
Because Java methods are always pass-by-value, we need to pass a value that can then be modified by the method in order to carry a new reference back to the caller. For simplicity we use a single-element array, and modify the 0th element of the array.
JulianDate originalDate = new JulianDate(2453736, 43233d, TimeStandard.getInternationalAtomicTime()); JulianDate out_date = new JulianDate; boolean result = originalDate.tryConvertTimeStandard(TimeStandard.getCoordinatedUniversalTime(), out_date); // result => true JulianDate date = out_date; // date.getStandard() => Coordinated Universal Time (UTC)
In this example, the conversion is successful, as indicated by the return value, and the converted value is returned in the out_Date parameter's 0th element.