fork download
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3. import java.util.List;
  4.  
  5. public class Main {
  6. public static void main(String args[]) {
  7. List<int[]> outputList = new ArrayList<>();
  8. int[] result = new int[] { 0, 1 };
  9. int[] result2 = new int[] { 2, 3 };
  10. outputList.add(result);
  11. outputList.add(result2);
  12.  
  13. System.out.println(
  14. Arrays.deepToString(outputList.toArray()).replaceAll("(?<=^)\\[", "{").replaceAll("\\](?=$)", "}"));
  15.  
  16. System.out.println(Arrays.deepToString(outputList.toArray()).replaceAll("(?<=^)\\[", "{")
  17. .replaceAll("\\](?=$)", "}").replace(" ", ""));
  18. }
  19. }
Success #stdin #stdout 0.08s 50156KB
stdin
Standard input is empty
stdout
{[0, 1], [2, 3]}
{[0,1],[2,3]}