hi how are u
i need to help plz my homwork it to sorting an arry whith recursion
in java and i rowht it but it dosnt work
CODE
import javax.swing.*;
import java.io.*;
public class asssaja {
static int i=1;
static int j=0;
static public void sorta(float a[],int x,int y)
{
float temp;
if(j==y)
return;
if (a[x]>a[i])
{
temp=a[x];
a[x]=a[i];
a[i]=temp;
}
i++;
sorta( a, j++, y);
}
public static void main(String args[])throws IOException{
int arnum;
String n,e;
n= JOptionPane.showInputDialog("pleas enter the number element of array");
arnum=Integer.parseInt(n);
float []array=new float[arnum];
for (int c=0;c<arnum;c++){
e= JOptionPane.showInputDialog("pleas enter"+(c+1)+"element of array");
array[c]=Float.parseFloat(e);
}
sorta(array,0,arnum-1);
String output="the element of array by sorted\n";
JTextArea t=new JTextArea();
for (int c=0;c<arnum;c++)
output+=array[c]+"\n ";
t.setText(output);
JOptionPane.showMessageDialog(null,t);
System.exit(0);
}
}
pleas hary
thank you