online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import java.util.Arrays; public class Main{ public static void main (String[] args){ int[] test = {1,2,3,4,5,6,7,8,9,10}; for(int i=1;i<=test.length;++i){ int[] arr = test.clone(); rotateArray(arr,i); System.out.println(i + " => " + Arrays.toString(arr)); } } private static void rotateArray(int[] arr,int m){ int left = 0,right = arr.length - 1; int limit = Math.min(m,arr.length/2); while(left < limit){ swap(arr,left++,right--); } reverse(arr,arr.length - m,arr.length-1); reverse(arr,m,arr.length-m-1); reverse(arr,0,arr.length-m-1); } private static void reverse(int[] arr,int left,int right){ while(left < right){ swap(arr,left++,right--); } } private static void swap(int[] arr,int x,int y){ int temp = arr[x]; arr[x] = arr[y]; arr[y] = temp; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue