fork download
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
    static String shifter(String stringToShift, int numberOfShifts){
        for(int i = 0; i < numberOfShifts;i++)
        {
            // Store the character you want to shift
            char temporaryChar = stringToShift.charAt(stringToShift.length()- i - 1);

            // Store the character with the original String. Character first
            stringToShift = temporaryChar + stringToShift;

            // Now that we did that, the string is 1 character longer so we need to take a substring of it
            stringToShift = stringToShift.substring(0, stringToShift.length()-1);
        }

        // After everything is done return the String
        return stringToShift;
    }
    
    public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println(shifter("abcde", 2));
	}
}
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
ceabc