From 8a952b797cfe8f96f13e4aed80aa9e530a647e65 Mon Sep 17 00:00:00 2001 From: zanninso <47645687+zanninso@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:50:11 +0100 Subject: [PATCH] CON-2553-Markdown-Sort-Array-exercise (#2526) * docs: adding subject * docs: rephrase exercice description to improve its clarity --------- Co-authored-by: amine --- .../java/checkpoints/sort-array/README.md | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 subjects/java/checkpoints/sort-array/README.md diff --git a/subjects/java/checkpoints/sort-array/README.md b/subjects/java/checkpoints/sort-array/README.md new file mode 100644 index 000000000..9711c0182 --- /dev/null +++ b/subjects/java/checkpoints/sort-array/README.md @@ -0,0 +1,39 @@ +## SortArray + +### Instructions + +In a file named `SortArray.java` write a function `sort` that returns the given array, specified in the parameters, sorted in ascending order. + +### Expected Functions + +```java +public class SortArray { + public static Integer[] sort(Integer[] args) { + // your code here + } +} +``` + +### Usage + +Here is a possible `ExerciseRunner.java` to test your function : + +```java +import java.io.*; +import java.util.Arrays; + +public class ExerciseRunner { + public static void main(String[] args) throws IOException { + System.out.println(Arrays.toString(SortArray.sort(new Integer[]{4, 2, 1, 3}))); + } +} +``` + +and its output : + +```shell +$ javac *.java -d build +$ java -cp build ExerciseRunner +[1, 2, 3, 4] +$ +```