[Java] Short clean code with explanation
Keep last n - k values as they should be. \u21D2 generating consecutive difference of 1\nFill from k\'th element to 1st element by alternately picking from incr
Keep last n - k values as they should be. \u21D2 generating consecutive difference of 1\nFill from k\'th element to 1st element by alternately picking from increasing direction (1 to k) and decreasing direction (k to 1). \u21D2 generating consecutive difference of k, k - 1, ... 3, 2, 1\n\n```\npublic int[] constructArray(int n, int k) {\n    int[] A = new int[n];\n    for(int i = k; i < n; i++) A[i] = i + 1;\n    for(int i = k - 1, val = 1; i >= 0; i -= 2) A[i] = val++;\n    for(int i = k - 2, val = k; i >= 0; i -= 2) A[i] = val--;\n    return A;\n}\n```
['Java']