Write a java program to find next greater element in an array. Given an input array, find the next greater element for every element of an array.The next greater element x is the first greater element on the right side of x in an array.

**For example**:

Let’s take an array: [4, 2, 6, 8, 1]

4 => 6 (First next greater element of 4 is 6)

2 => 6 (Next greater element of 2 is 6)

6 => 8 (Next greater element of 6 is 8)

8 => null

1 => null