Hi guys, I have written the following code which iterates over a integer array and returns a string by concatening the digits. Is there is an easier or more efficient way of writing this in Java similar to the C# function ToString?

private int[] myArray;

public int[] getMyArray
{
    return myArray;
}

public String getArrayAsString()
{
      String arrayAsString = "";

      for(int index = 0; index < getMyArray().length; index++)
      {
         arrayAsString = arrayAsString + Integer.toString(
                getMyArray()[index]);
      }
       
       return arrayAsString;
}

For each loop

int[] intArray = getMyArray();
for(int i: intArray)
{
    arrayAsString = arrayAsString + i;
}

Don't you want to provide some sort of separator between values (space, comma, semicolon, etc)?

you can use
Arrays.toString(int[] array)

you can use
Arrays.toString(int[] array)

Good suggestion too