Returns the first instance of the given byte in the byte array between the specified start and end. @param bytes The byte array to search @param start The point to start searching from in the byte array @param end The point to stop searching in the byte array @param b The byte to search for
(byte[] bytes, int start, int end, byte b)
| 963 | * @return The position of the first instance of the byte or -1 if the byte is not found. |
| 964 | */ |
| 965 | public static int findByte(byte[] bytes, int start, int end, byte b) { |
| 966 | int offset = start; |
| 967 | while (offset < end) { |
| 968 | if (bytes[offset] == b) { |
| 969 | return offset; |
| 970 | } |
| 971 | offset++; |
| 972 | } |
| 973 | return -1; |
| 974 | } |
| 975 | |
| 976 | |
| 977 | /** |
no outgoing calls