method to print some stats for a tree

This commit is contained in:
2020-10-07 18:50:19 +02:00
parent 4749dca73a
commit f9ed27f03b
4 changed files with 161 additions and 11 deletions

View File

@@ -0,0 +1,24 @@
package org.lucares.utils;
public class ArrayUtils {
public static int findFirst(final byte[] bytes, final byte key) {
for (int i = 0; i < bytes.length; i++) {
if (bytes[i] == key) {
return i;
}
}
return -1;
}
public static int countConsecutive(final byte[] bytes, final byte key, final int offset) {
int count = 0;
for (int i = offset; i < bytes.length; i++) {
if (bytes[i] == key) {
count++;
} else {
break;
}
}
return count;
}
}