@@ -0,0 +1,1563 @@
+/* ============================================================================%0D%0A * Copyright (c) 2015 Imagic Bildverarbeitung AG, CH-8152 Glattbrugg.%0D%0A * All rights reserved.%0D%0A *%0D%0A * http://www.imagic.ch/%0D%0A * ============================================================================%0D%0A */%0D%0Apackage algorithm;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/**%0D%0A *%0D%0A * @version $Revision$%0D%0A * @version $Date$%0D%0A * @author $Author$%0D%0A * @owner Sandro Mario Zbinden%0D%0A */%0D%0Apublic class LoopInvariant %7B%0D%0A%0D%0A    public static class Solution %7B%0D%0A%0D%0A        public static void insertionSort(int%5B%5D A) %7B%0D%0A            for (int i = 1; i %3C A.length; i++) %7B%0D%0A                int value = A%5Bi%5D;%0D%0A                int j = i - 1;%0D%0A                while (j %3E= 0 && A%5Bj%5D %3E value) %7B //The fix is to use %3E= instead of %3E%0D%0A                    A%5Bj + 1%5D = A%5Bj%5D;%0D%0A                    j = j - 1;%0D%0A                %7D%0D%0A                A%5Bj + 1%5D = value;%0D%0A            %7D%0D%0A            printArray(A);%0D%0A        %7D%0D%0A%0D%0A        static void printArray(int%5B%5D ar) %7B%0D%0A            for (int n : ar) %7B%0D%0A                System.out.print(n + %22 %22);%0D%0A            %7D%0D%0A        %7D%0D%0A%0D%0A        public static void main(String%5B%5D args) %7B%0D%0A            try (Scanner in = new Scanner(System.in)) %7B%0D%0A                int n = in.nextInt();%0D%0A                int%5B%5D ar = new int%5Bn%5D;%0D%0A                for (int i = 0; i %3C n; i++) %7B%0D%0A                    ar%5Bi%5D = in.nextInt();%0D%0A                %7D%0D%0A                insertionSort(ar);%0D%0A            %7D%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A        Solution.main(null);%0D%0A    %7D%0D%0A%0D%0A%7D%0D%0A

Add the LoopInvariant challange