NextGreaterElement { public int nextGreaterElementIII(int n) { List<Integer> list = new ArrayList<>(); while (n > 0) { list.add(n % 10); n = n / 10; } Collections.reverse(list); return nextGreaterElementFromFirst(list.stream().mapToInt(Integer::valueOf).toArray()); }  int[] nextGreaterElementI(int[] nums1, int[] nums2); int[] nextGreaterElementsII(int[] nums); int nextGreaterElementIII(int n);  }
@Test(dataProvider = "nextElements") public void test(int value, int next) { System.out.printf("#######test value = %d\n", value); assertEquals(new NextGreaterElement().nextGreaterElementIII(value), next); }