Write a linear (O(N)) running time complexity program in Java to find all the dominant elements in the given array of N distinct integer elements. An element is a dominant element if is greater than all the elements to its right side. The rightmost element in the array is always a dominant element.