Question: Convert this code written in Java to Assembly language : public class LargestInArrayExample{ public static int getLargest(int[] a, int total){ int temp; for (int i

Convert this code written in Java to Assembly language :

public class LargestInArrayExample{

public static int getLargest(int[] a, int total){

int temp;

for (int i = 0; i < total; i++)

{

for (int j = i + 1; j < total; j++)

{

if (a[i] > a[j])

{

temp = a[i];

a[i] = a[j];

a[j] = temp;

}

}

}

return a[total-1];

}

public static void main(String args[]){

int a[]={1,2,5,6,3,2};

System.out.println("Largest: "+getLargest(a,6));

}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!