mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-13 13:35:13 +00:00
Conversion#binaryToHexDigit(boolean[], int): Simplify implementation by removing redundant conditions.
This commit is contained in:
parent
670a832d4d
commit
ff05749cdc
@ -311,19 +311,19 @@ public static char binaryToHexDigit(final boolean[] src, final int srcPos) {
|
||||
throw new IllegalArgumentException("Cannot convert an empty array.");
|
||||
}
|
||||
if (src.length > srcPos + 3 && src[srcPos + 3]) {
|
||||
if (src.length > srcPos + 2 && src[srcPos + 2]) {
|
||||
if (src.length > srcPos + 1 && src[srcPos + 1]) {
|
||||
if (src[srcPos + 2]) {
|
||||
if (src[srcPos + 1]) {
|
||||
return src[srcPos] ? 'f' : 'e';
|
||||
}
|
||||
return src[srcPos] ? 'd' : 'c';
|
||||
}
|
||||
if (src.length > srcPos + 1 && src[srcPos + 1]) {
|
||||
if (src[srcPos + 1]) {
|
||||
return src[srcPos] ? 'b' : 'a';
|
||||
}
|
||||
return src[srcPos] ? '9' : '8';
|
||||
}
|
||||
if (src.length > srcPos + 2 && src[srcPos + 2]) {
|
||||
if (src.length > srcPos + 1 && src[srcPos + 1]) {
|
||||
if (src[srcPos + 1]) {
|
||||
return src[srcPos] ? '7' : '6';
|
||||
}
|
||||
return src[srcPos] ? '5' : '4';
|
||||
|
Loading…
x
Reference in New Issue
Block a user