src/share/classes/java/lang/Long.java

Print this page

        

*** 1537,1544 **** --- 1537,1583 ---- i = (i & 0x00ff00ff00ff00ffL) << 8 | (i >>> 8) & 0x00ff00ff00ff00ffL; return (i << 48) | ((i & 0xffff0000L) << 16) | ((i >>> 16) & 0xffff0000L) | (i >>> 48); } + /** + * Adds two {@code long} values together as per the + operator. + * + * @param a the first operand + * @param b the second operand + * @return the sum of {@code a} and {@code b} + * @see java.util.function.BinaryOperator + * @since 1.8 + */ + public static long sum(long a, long b) { + return a + b; + } + + /** + * Returns the greater of two {@code long} values. + * + * @param a the first operand + * @param b the second operand + * @return the larger of {@code a} and {@code b} + * @see java.util.function.BinaryOperator + * @since 1.8 + */ + public static long max(long a, long b) { + return Math.max(a, b); + } + + /** + * Returns the lesser of two {@code long} values. + * + * @param a the first operand + * @param b the second operand + * @return the lesser of {@code a} and {@code b} + * @see java.util.function.BinaryOperator + * @since 1.8 + */ + public static long min(long a, long b) { + return Math.min(a, b); + } + /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = 4290774380558885855L; }