public static String flagsToString(int flags, IntFunction<String> getFlagName) {
        StringBuilder builder = new StringBuilder();
        int count = 0;
        while (flags != 0) {
            final int flag = 1 << Integer.numberOfTrailingZeros(flags);
            flags &= ~flag;
            if (count > 0) builder.append(", ");
            builder.append(getFlagName.apply(flag));
            count++;
        }
        TextUtils.wrap(builder, "[", "]");
        return builder.toString();
    }
A utility class for handling unsigned integers and unsigned arithmetics, as well as syntactic
sugar methods for ByteBuffer. Useful for networking and packet manipulations.
{@hide}
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/BitUtils.java