13- Solution- Building a Priority Queue

Hi Mosh,

I’m not able to understand the below mentioned code block, please help me.

int j;

		for(j= count-1;j >= 0; j--)
		{
			
			System.out.println("Current item-->" +items[j]);
			System.out.println("J Count-->" + j);
			System.out.println("Count-->" + count);
			System.out.println("To Insert Item-->" +i);
			
			if(items[j] > i  )
			{
				items[j+1] =items[j];
			}
			else
			break;

		}

// The below block///////////////////////////////////////////////////////////////
System.out.println(“J Value–>”+j);
items[j+1] = i;
///////////////////////////////////////////////////////////////////////////////////

		count++;
		
		System.out.println(Arrays.toString(items));
		System.out.println(count);

Not certain I know what you are having trouble with, but after the loop j will have the index where the value needed to go and he prints it out then inserts the value at the next slot.