Home | History | Annotate | Download | only in primitives

Lines Matching refs:Byte

27  * Static utility methods pertaining to {@code byte} primitives that
40 * Returns the {@code byte} value that is equal to {@code value}, if possible.
42 * @param value any value in the range of the {@code byte} type
43 * @return the {@code byte} value that equals {@code value}
45 * Byte#MAX_VALUE} or less than {@link Byte#MIN_VALUE}
47 public static byte checkedCast(long value) {
48 byte result = (byte) value;
54 * Returns the {@code byte} nearest in value to {@code value}.
57 * @return the same value cast to {@code byte} if it is in the range of the
58 * {@code byte} type, {@link Byte#MAX_VALUE} if it is too large,
59 * or {@link Byte#MIN_VALUE} if it is too small
61 public static byte saturatedCast(long value) {
62 if (value > Byte.MAX_VALUE) {
63 return Byte.MAX_VALUE;
65 if (value < Byte.MIN_VALUE) {
66 return Byte.MIN_VALUE;
68 return (byte) value;
72 * Compares the two specified {@code byte} values. The sign of the value
73 * returned is the same as that of {@code ((Byte) a).compareTo(b)}.
75 * @param a the first {@code byte} to compare
76 * @param b the second {@code byte} to compare
80 public static int compare(byte a, byte b) {
87 * @param array a <i>nonempty</i> array of {@code byte} values
92 public static byte min(byte... array) {
94 byte min = array[0];
106 * @param array a <i>nonempty</i> array of {@code byte} values
111 public static byte max(byte... array) {
113 byte max = array[0];
123 * Returns a string containing the supplied {@code byte} values separated
129 * @param array an array of {@code byte} values, possibly empty
131 public static String join(String separator, byte... array) {
147 * Returns a comparator that compares two {@code byte} arrays
149 * #compare(byte, byte)}), the first pair of values that follow any common
156 * it is consistent with {@link java.util.Arrays#equals(byte[], byte[])}.
162 public static Comparator<byte[]> lexicographicalComparator() {
166 private enum LexicographicalComparator implements Comparator<byte[]> {
169 public int compare(byte[] left, byte[] right) {