class DegreesMinutesSeconds extends Coordinates {

    private static String toShortLabelString(int width, int precision, double magnitude)
    {
        double degrees = (int)magnitude;
        if (degrees == 0. && magnitude < 0.)
        {
            degrees = -0.;
        }
        int minutes = getMinutes(magnitude);
        double seconds = getSeconds(magnitude);

        int secWidth = getSecondsWidth(width, precision);
        int secPrec = getSecondsPrecision(precision, secWidth);

        double roundingThreshold = 60 - 5 * Math.pow(10, -secPrec - 1);
        if (seconds >= roundingThreshold)
        {
            if (minutes == 59)
            {
                minutes = 0;
                degrees = magnitude > 0. ? degrees + 1 : degrees - 1;
            }
            else
            {
                ++minutes;
            }
            seconds = 0.;
        }

        if (getMinutesWidth(width) == 0 && minutes >= 30)
        {
            degrees = magnitude > 0. ? degrees + 1 : degrees - 1;
        }
        return String.format(getFormatString(width, precision), Double.valueOf(degrees), Integer.valueOf(minutes),
                Double.valueOf(seconds));
    }

    public  DegreesMinutesSeconds(Coordinates ang);
    public  DegreesMinutesSeconds(double degrees);

}