diff --git a/src/main/java/at/favre/lib/bytes/Base64.java b/src/main/java/at/favre/lib/bytes/Base64.java index 730c554..dd31fbf 100644 --- a/src/main/java/at/favre/lib/bytes/Base64.java +++ b/src/main/java/at/favre/lib/bytes/Base64.java @@ -93,7 +93,7 @@ static byte[] decode(CharSequence in) { } // Append this char's 6 bits to the word. - word = (word << 6) | (byte) bits; + word = (word << 6) | (byte) bits & 0xff; // For every 4 chars of input, we accumulate 24 bits of output. Emit 3 bytes. inCount++; diff --git a/src/main/java/at/favre/lib/bytes/BaseEncoding.java b/src/main/java/at/favre/lib/bytes/BaseEncoding.java index 8fe8d3e..8e23588 100644 --- a/src/main/java/at/favre/lib/bytes/BaseEncoding.java +++ b/src/main/java/at/favre/lib/bytes/BaseEncoding.java @@ -28,10 +28,10 @@ /** * Encoder which supports arbitrary alphabet and padding. - * + *

* Derived from Google Guava's common/io/ BaseEncoding *

- * See: https://github.com/google/guava/blob/v26.0/guava/src/com/google/common/io/BaseEncoding.java + * See: BaseEncoding */ final class BaseEncoding implements BinaryToTextEncoding.EncoderDecoder { private static final char ASCII_MAX = 127; @@ -190,7 +190,7 @@ char encode(int bits) { } int decode(char ch) { - return (int) decodabet[ch]; + return decodabet[ch]; } } diff --git a/src/main/java/at/favre/lib/bytes/Bytes.java b/src/main/java/at/favre/lib/bytes/Bytes.java index c2b5b20..33fb08d 100644 --- a/src/main/java/at/favre/lib/bytes/Bytes.java +++ b/src/main/java/at/favre/lib/bytes/Bytes.java @@ -31,7 +31,7 @@ import java.util.*; /** - * Bytes is wrapper class for an byte-array that allows a lot of convenience operations on it: + * "Bytes" is wrapper class for a byte-array that allows a lot of convenience operations on it: *