src/share/classes/java/lang/Byte.java
Print this page
*** 513,520 ****
--- 513,559 ----
*
* @since 1.8
*/
public static final int BYTES = SIZE / Byte.SIZE;
+ /**
+ * Adds two {@code byte}s 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 byte sum(byte a, byte b) {
+ return (byte) (a + b);
+ }
+
+ /**
+ * Returns the greater of two {@code byte} 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 byte max(byte a, byte b) {
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the lesser of two {@code byte} 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 byte min(byte a, byte b) {
+ return (a <= b) ? a : b;
+ }
+
/** use serialVersionUID from JDK 1.1. for interoperability */
private static final long serialVersionUID = -7183698231559129828L;
}