java – Program to check if the order of the segments is correct or not

There is a Java program to check if a heap (Min) is in the right order. Heap order means that the parent is inferior to the left and right children.

package testers;

heap of import.
import java.util.List;

public class HeapTester
{
public static void main (String[] args)
{
heap tas = new heap <> ();
tas.add (50);
tas.add (25);
tas.add (26);
tas.add (15);
tas.add (10);
tas.add (16);
tas.add (3);
tas.add (7);
tas.add (10);
tas.add (12);
tas.add (2);
System.out.println (heap);
System.out.println (hasHeapOrder (heap.copy ()));
}

private static <T extends Comparable> boolean hasHeapOrder (List listing)
{
if (list.size () <2) returns true;

boolean hasOrder = true;

int parent = 0;
int leftChild = 2 * parent + 1;
int rightChild = 2 * parent + 2;

while (leftChild < list.size())
        {
            if(list.get(parent).compareTo(list.get(leftChild)) > 0)
{
hasOrder = false;
Pause;
}
if (rightChild < list.size())
            {
            if(list.get(parent).compareTo(list.get(rightChild)) > 0)
{
hasOrder = false;
Pause;
}
}

parent ++;
leftChild = 2 * parent + 1;
rightChild = 2 * parent + 2;
}
return hasOrder;
}
}