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 efa66c4 commit d85b422Copy full SHA for d85b422
src/main/java/at/favre/lib/bytes/Util.java
@@ -322,11 +322,12 @@ private Converter() {
322
* is null
323
*/
324
static byte[] toArray(Collection<java.lang.Byte> collection) {
325
- Object[] boxedArray = collection.toArray();
326
- int len = boxedArray.length;
327
- byte[] array = new byte[len];
328
- for (int i = 0; i < len; i++) {
329
- array[i] = (java.lang.Byte) boxedArray[i];
+ final int len = collection.size();
+ final byte[] array = new byte[len];
+ int i = 0;
+ for (java.lang.Byte b : collection) {
+ array[i] = b;
330
+ i++;
331
}
332
return array;
333
0 commit comments