SexagesimalFormatter in Java

Sexagesimal is a measurement system in which an angle is measured in degrees, minutes, and seconds. In Java, SexagesimalFormatter is a formatter class that belongs to herschel.share.fltdyn.math package. It extends the Object class. It is used to parse and format sexagesimal values. The base-60 values are known as sexagesimal values. The motive of the class is to represent angles used in time in form of Hours-Minutes-Seconds (HMS) or Degrees-Minutes-Seconds (DMS). Besides this, we can also use it for time.

Java SexagesimalFormatter Class Constructor

The SexagesimalFormatter class defines the following two constructors:

ConstructorsDescription
SexagesimalFormatter(SexagesimalFormatter.Mode mode)It creates a SexagesimalFormatter.
SexagesimalFormatter(String separators, boolean hours, boolean nonNegative)It creates a custom SexagesimalFormatter.

Java SexagesimalFormatter Class Methods

MethodsDescription
format(boolean sign, int hrsDeg, int min, int sec, int frac, int fracWidth)It formats the degrees, minutes, hours, and seconds in sexagesimal String.
formatDegrees(double degrees)It formats a value in degrees as a sexagesimal String.
formatRadians(double radians)It formats a value in radians as a sexagesimal String.
formatSeconds(double seconds)It formats a value in seconds as a sexagesimal String.
parseDegrees(String string)It parses sexagesimal String as a value in degrees.
parseFields(String string)It parses sexagesimal String as an array of values.
parseRadians(String string)It parses sexagesimal String as a value in radians.
parseSeconds(String string)It parses sexagesimal String as a value in seconds.
setDecimals(int decimals)It set the number of decimal places of seconds for formatting, with rounding.
setOmitDecimalPoint(boolean enable)It specifies that decimal point should be omitted when formatting.
setSeparatorBeforePoint(boolean enable)It specifies that the seconds separator is before the decimal point.
setShowLeadingZeros(boolean enable)The format using leading zeros.
setShowPlusSign(boolean enable)It uses explicit "+" sign for positive angles for formatting.
toString()It returns a String representation of this object.

Besides these methods, it also inherited the methods from the Object class.