Returns the int nearest in value to value. @param value any long value @return the same value cast to int if it is in the range of the int type, Integer#MAX_VALUE if it is too large, or Integer#MIN_VALUE if it is too small
(long value)
| 109 | |
| 110 | |
| 111 | public static int saturatedCast(long value) { |
| 112 | if (value > Integer.MAX_VALUE) { |
| 113 | return Integer.MAX_VALUE; |
| 114 | } |
| 115 | if (value < Integer.MIN_VALUE) { |
| 116 | return Integer.MIN_VALUE; |
| 117 | } |
| 118 | return (int) value; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Compares the two specified {@code int} values. The sign of the value returned is the same as |
no outgoing calls
no test coverage detected