Question
/* Task 2. * * Requirements: * - It is strictly forbidden for you to use: * + Any Java library method (e.g., Arrays.sort) *
/* Task 2. * * Requirements: * - It is strictly forbidden for you to use: * + Any Java library method (e.g., Arrays.sort) * (That is, there must not be an import statement in the beginning of this class.) * + arrays * - You will receive an immediate zero for this task if the requirement is violated. * * Input Parameters: * - `n1`: first number * - `n2`: second number * - `n3`: third number * - `n4`: fourth number * Note. These four input numbers are not necessarily unique. They might contain duplicates. * * Error conditions (in order of priority): * - None. No error message is needed. * * What to return? * - Return a report of the smallest number and the second smallest number. * * See the JUnit tests related to this method for the precise format of the string return value. */ public static String getSmallestTwoNumbers(int n1, int n2, int n3, int n4) { String result = "";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started