GenericMath { public static <N extends Comparable<N>> N min(N a, N b) { return a.compareTo(b) < 0 ? a : b; }  @SuppressWarnings("unchecked") static N add(N a, M b); @SuppressWarnings("unchecked") static N subtract(N a, M b); @SuppressWarnings("unchecked") static N multiply(N a, M b); @SuppressWarnings("unchecked") static N divide(N a, M b); static N min(N a, N b); static N max(N a, N b); static BigInteger bigInt(Number n); static BigDecimal bigDec(Number n);  }
@Test public void min_Integer() { Integer a = 42; Integer b = 100; assertEquals(a, min(a, b)); assertEquals(a, min(b, a)); }
@Test public void min_Long() { Long a = 42L; Long b = 100L; assertEquals(a, min(a, b)); assertEquals(a, min(b, a)); }
@Test public void min_Float() { Float a = 42F; Float b = 100F; assertEquals(a, min(a, b)); assertEquals(a, min(b, a)); }
@Test public void min_Double() { Double a = 42D; Double b = 100D; assertEquals(a, min(a, b)); assertEquals(a, min(b, a)); }
@Test public void min_String() { String a = "a"; String b = "b"; assertEquals(a, min(a, b)); assertEquals(a, min(b, a)); }