static void sanityCheckLastPos(int pos, int mask) {
        if ((pos & mask) != 0) {
            throw new IllegalArgumentException
                ("Invalid last non-pad character detected");
        }
    }
Sanity check the last decoded position is a possible value.

@throws IllegalArgumentException if the given decoded position is
not a possible value produced via the respective encoding
aws-java-sdk-core/src/main/java/com/amazonaws/util/CodecUtils.java