- What is wrong with the following code? This piece of codeincorrectly attempts to find the largest value in a queue ofintegers. How would you fix it? You will need to write a class withthe main(String[] args) {….} method to test the following piece ofcode, find the problem, and fix it.

**int**largest **=** q**.**remove**(); //assume the first one is the largest.**

**for****(****int**i**=**0**;** i **<**q**.**size**();** i**++)****{**

largest **=**Math**.***max***(**largest**,**q**.**remove**());**

**}**

There are many ways to find the maxi value from a queue list.For this problem, you are not allowed to use any collectionutilities; you will have to use the Math.max( largest, q.remove( ))method and you cannot modify the original queue contents. Forexample, with my queue list (1, 2, 3, 99, -4, 6), the resultsshould look like the following.

Orginal list

[1, 2, 3, 99, -4, 6]

largest = 99

After finding maxi, the list is

[1, 2, 3, 99, -4, 6]

## Expert Answer

Answer to What is wrong with the following code? This piece of code incorrectly attempts to find the largest value in a queue of …