How can the Array content be converted to a String in Java?
Example:
int[] myArray = {1,2,3};
The output has to be:
"123"
Arrays.toString(myArray) is returning:
"[1, 2, 3]"
and myArray.toString(), returns:
[I@12a3a380
So none of them works. Is there a function for this?
This question might look similar to (this), but is actually different. I am literally asking for a String made of all the array entries.
IntStream.of(myArray).mapToObj(Integer::toString).collect(joining("")).IntStream.of(myArray)just callsArrays.streaminternally... and I don't think this is a duplicate on how to print the contents of an array, this does not look like a duplicate to meStringarray withString.join