How to convert Byte array to byte array [duplicate]

113
August 12, 2019, at 7:30 PM

This question already has an answer here:

  • how to convert byte[] to Byte[], and the other way around? 6 answers

I want to convert a Byte array into a byte array, but I don't see any way to do so in java without using a loop.

Can someone please tell me a way to make it ?

Answer 1

There is no need for that, because Java has an auto-unboxing system that automatically converts Bytes to bytes. So, you can use them the same way. But if you really have to, you have to use a loop.

Answer 2
Byte[] byteObject = new Byte[0];
byte[] bytes = ArrayUtils.toPrimitive(byteObject);

Source

READ ALSO
Multi field updates in document in java mongodb

Multi field updates in document in java mongodb

Below is my mongob document structure

116
JLink plugin for gradle gives error that file could not be found

JLink plugin for gradle gives error that file could not be found

I am trying to create a standalone runtime image, as described in this answerWhen I try to run the JLink task from the 'Badass JLink" plugin for gradle, I get the following error:

78
Highest performance for Keyboard Input

Highest performance for Keyboard Input

So I have a small java game engine using a single JFrame

106
JavaFX Application Thread - When using Gluon Ignite Dependency Injection

JavaFX Application Thread - When using Gluon Ignite Dependency Injection

I'm using Gluon's Ignite dependency injection library and when I run this code I get this following error

94