Can you please help to figure out how to implement the user’sinput of values and fix this error that I keep receiving
Exception in thread “main”java.lang.ArrayIndexOutOfBoundsException: 0
atjavaapplication11.JavaApplication11.main(JavaApplication11.java:157)
package javaapplication9;
import java.lang.*;
import java.nio.file.*;
import java.util.Scanner;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
// ExternalSort class
public class JavaApplication9
{
public static String sort(String s)
{
String[] strings = s.split(” “);
int length = strings.length;
int[] ray = new int[length];
for(int i = 0; i < length; i++)
{
int min = i;
for(int x = i; x < length; x++)
if(Integer.parseInt(strings[x]) <Integer.parseInt(strings[min]))
{
min = x;
}
ray[i] = Integer.parseInt(strings[min]);
strings[min] = strings[i];
}
String output = “”;
for (int i = 0; i < ray.length; i++)
output += ray[i] + ” “;
return output;
}
public static void print(Path p)
{
try(Scanner sc =