We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcfcaba commit b24bccfCopy full SHA for b24bccf
src/main/java/at/favre/lib/bytes/Bytes.java
@@ -86,8 +86,9 @@ public static Bytes allocate(int length) {
86
* @return new instance
87
*/
88
public static Bytes allocate(int length, byte defaultValue) {
89
+ if (length == 0) return EMPTY;
90
byte[] array = new byte[length];
- if (defaultValue != 0 && length > 0) {
91
+ if (defaultValue != 0) {
92
Arrays.fill(array, defaultValue);
93
}
94
return wrap(array);
0 commit comments