i want last element of my arraylist and want to put it at 1st place : <p>I want my last element from my arraylist and i want to put it at 1st position of my arraylist and after that i want to remove my last element of an arraylist.</p>

<pre><code>    public class Array {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int[] array = {13,25,35,74,5,16,73,8};
        Scanner sc = new Scanner(System.in);

        System.out.println("Please Enter Value to Swipe:");
        int position = sc.nextInt();
        sc.nextLine();
        List&lt;Integer&gt; NewArray = new ArrayList&lt;Integer&gt;();  

        if(position &gt; array.length){
            position = position % array.length;
        }
        for(int i = 0;i &lt;= array.length-1;i++) {
            NewArray.add(array[i]);
        }
        System.out.println("  "+NewArray);

        for(int k = position;k &lt;= position;k++) {

              NewArray.add(0,NewArray.get(NewArray.size()));   
              System.out.println("  "+NewArray);
              NewArray.remove(array.length);

        }
         System.out.println("  "+NewArray);
    }

}
</code></pre>
