Advertisement
paganoantonio

Untitled

Apr 9th, 2022
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         int[] r = { 4, 9, 3, 7 }; // Risultato previsto {7,4,9,3}
  2.  
  3.         int index = r.length - 1;
  4.         int last = r[r.length - 1];
  5.         for (int i = r.length - 2; i >= 0; i--) {
  6.            
  7.              r[i+1] = r[i];
  8.  
  9.         }
  10.         r[0]= last;
  11.        
  12.         for (int i = 0; i < r.length; i++) {
  13.             System.out.println(r[i]);
  14.         }
Advertisement
RAW Paste Data Copied
Advertisement