fork download
  1. import java.io.*;
  2. import java.util.*;
  3. class X{
  4. public static void main(String args[]) throws Exception{
  5. Reader re = new Reader(System.in);
  6. int T = re.nextInt();
  7. while(T-->0){ // test case loop
  8.  
  9. //main code goes here
  10.  
  11. //example below
  12. int N = re.nextInt();
  13. int a[] = re.intArray();
  14.  
  15. Arrays.sort(a);
  16.  
  17. pw.println(N+" "+Arrays.toString(a));
  18.  
  19. }
  20. pw.flush();
  21. }
  22. }
  23.  
  24.  
  25. class Reader{
  26. String words[];
  27. int p;
  28. br = new BufferedReader(new InputStreamReader(in));
  29. words = new String[]{};
  30. p = 0;
  31. }
  32.  
  33. void ensureInput() throws Exception{
  34. while(p==words.length){
  35. words = br.readLine().trim().split("\\s+");
  36. p = 0;
  37. }
  38. }
  39.  
  40. String next() throws Exception{
  41. ensureInput();
  42. return words[p++];
  43. }
  44.  
  45. int nextInt() throws Exception{
  46. return Integer.parseInt(next());
  47. }
  48.  
  49. int[] intArray() throws Exception{
  50. ensureInput();
  51. int a[] = Arrays.stream(words, p, words.length).mapToInt(Integer::parseInt).toArray();
  52. p = words.length;
  53. return a;
  54. }
  55.  
  56. long nextLong() throws Exception{
  57. return Long.parseLong(next());
  58. }
  59.  
  60. long[] longArray() throws Exception{
  61. ensureInput();
  62. long a[] = Arrays.stream(words, p, words.length).mapToLong(Long::parseLong).toArray();
  63. p = words.length;
  64. return a;
  65. }
  66.  
  67. double nextDouble() throws Exception{
  68. return Double.parseDouble(next());
  69. }
  70. }
Success #stdin #stdout 0.13s 4386816KB
stdin
1
5
17 42 78 12 61
stdout
5 [12, 17, 42, 61, 78]