diff --git a/src/main/java/org/apache/commons/lang3/Conversion.java b/src/main/java/org/apache/commons/lang3/Conversion.java index de480817c..18873d917 100644 --- a/src/main/java/org/apache/commons/lang3/Conversion.java +++ b/src/main/java/org/apache/commons/lang3/Conversion.java @@ -311,19 +311,19 @@ public class Conversion { 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';