Convert { @NonNull public static String angle2(double degrees) { degrees = (degrees + 540) % 360 - 180; if (degrees < 0) return ConvertUtil.formatInt(-degrees, 2) + " left"; else if (degrees == 0) return "straight"; else if (degrees > 0) return ConvertUtil.formatInt(degrees, 2) + " right"; else return ""; }  static double kts2mps(double knots); @NonNull static String altitude(double m); @NonNull static String distance(double m); @NonNull static String distance(double m, int precision, boolean units); @NonNull static String distance2(double m, int precision); @NonNull static String distance3(double m); @NonNull static String speed(double mps); @NonNull static String speed(double mps, int precision, boolean units); @NonNull static String glide(double glideRatio, int precision, boolean units); @NonNull static String glide(double groundSpeed, double climb, int precision, boolean units); @NonNull static String glide2(double groundSpeed, double climb, int precision, boolean units); @NonNull static String pressure(double hPa); @NonNull static String angle(double degrees); @NonNull static String angle2(double degrees); @NonNull static String bearing2(double degrees); static boolean metric; static final double FT; static final double MPH; static final double KPH; static final float MPHf; static final float KPHf; static final String GLIDE_STATIONARY; static final String GLIDE_LEVEL; static final String GLIDE_VERTICAL; }
@Test public void convertAngle2() { assertEquals("straight", Convert.angle2(0.0)); assertEquals("90 right", Convert.angle2(90.0)); assertEquals("90 right", Convert.angle2(90.5)); assertEquals("130 right", Convert.angle2(135.0)); assertEquals("130 left", Convert.angle2(-135.0)); assertEquals("", Convert.angle2(Double.NaN)); }