I am a newbie in Java programming and I have a trouble in my program. I have an array and i want to extract the max integer from it and return it to the main program. But without using ArrayList. I must not have 0 in this certain position when i print it so I cant just replace it. Take a look at what i did so far but i think that it is so wrong.
public int extractMax()
{
for (int i = 0; i < size; i++)
{
if(maxInsert == Queue[i])
{
Queue[i] = null;
return maxInsert;
}
} return -1;
}