MCPcopy Create free account
hub / github.com/antlr/codebuff / checkedCast

Method checkedCast

output/java_guava/1.4.18/UnsignedBytes.java:89–96  ·  view source on GitHub ↗

Returns the byte value that, when treated as unsigned, is equal to value, if possible. @param value a value between 0 and 255 inclusive @return the byte value that, when treated as unsigned, equals value @throws IllegalArgumentException if value is negative o

(long value)

Source from the content-addressed store, hash-verified

87 */
88
89 @CanIgnoreReturnValue
90 public static byte checkedCast(long value) {
91 if ((value >> Byte.SIZE) != 0) {
92 // don't use checkArgument here, to avoid boxing
93 throw new IllegalArgumentException("Out of range: " + value);
94 }
95 return (byte) value;
96 }
97
98 /**
99 * Returns the {@code byte} value that, when treated as unsigned, is nearest in value to

Callers 1

writeToMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected