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

Method checkedCast

output/java_guava/1.4.18/SignedBytes.java:60–67  ·  view source on GitHub ↗

Returns the byte value that is equal to value, if possible. @param value any value in the range of the byte type @return the byte value that equals value @throws IllegalArgumentException if value is greater than Byte#MAX_VALUE or less than

(long value)

Source from the content-addressed store, hash-verified

58
59
60 public static byte checkedCast(long value) {
61 byte result = (byte) value;
62 if (result != value) {
63 // don't use checkArgument here, to avoid boxing
64 throw new IllegalArgumentException("Out of range: " + value);
65 }
66 return result;
67 }
68
69 /**
70 * Returns the {@code byte} nearest in value to {@code value}.

Callers 1

writeToMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected