Code/Java/rotateArrayWithD_Elements.java
/*This function swaps d elements starting from index f with d elements
starting at index s */
This function swaps d elements starting from index f with d elements
starting at index s
This function swaps d elements starting from index f with d elements starting at index s
public static void swap(int a[], int f, int s, int d)
{
    int temp;
    for(int i = 0; i < d; i++)
    {
        temp = a[f + i];
        a[f + i] = a[s + i];
        a[s + i] = temp;
    }
}
public static void swap ( int a [ ] , int f , int s , int d ) { int temp ; for ( int i = 0 ; i < d ; i ++ ) { temp = a [ f + i ] ; a [ f + i ] = a [ s + i ] ; a [ s + i ] = temp ; } }
This function swaps d elements starting from index f with d elements
starting at index s
This function swaps d elements starting from index f with d elements starting at index s