Hello! Could anybody help me to make this java code( or part) to assembly (mips 32)? I would apprecιate any help! The java code is:
import java.io.*;
class BinarySearch
{ final static int MAX=5;
public static void main (String args[]) throws IOException
{ char [] a = new char [MAX];
System.out.print("Give "+MAX+"Characters: ");
for (int i=0; i<MAX; i++) a[i]=(char) System.in.read();
System.in.read();
System.out.print("Key?:");
char key = (char) System.in.read();
bsort (a);
int found = bsearch(a,key);
if (found== -1)
System.out.print(key+" not found in array:");
else
System.out.print(key+" found in array:");
for (int i=0; i<MAX;i++) System.out.print(a[i]);
}
static void bsort(char a [])
{ char hold;
for (int j= MAX-1; j>=0; j--)
for (int i=0; i<=j-1;i++)
if (a[i]>a[i+1])
{ hold=a[i];
a[i]=a[i+1];
a[i+1]=hold;
}
}
static int bsearch(char a [], char key)
{ int low=0;
int high=MAX-1;
int middle;
while (low<=high)
{ middle = calc_middle(low,high);
if (key== a[middle]) return middle;
else if (key<a[middle]) high=middle-1;
else low= middle+1;
}
return -1;
}
static int calc_middle(int l, int h)
{ return ((l+h)/2);
}
}