/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

import java.util.stream.* ;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] input = { 8 , 6 , 7 , 5 , 3 , 0 , 9 , 8 };  // Repeating `8` at beginning and end. 
		int[] result = removingDups4( input ) ;
		System.out.println( Arrays.toString( result ) ) ;
	}
	
	static int[] removingDups4(int[] arr) {
    return 
        new ArrayList<>(
            Arrays
            .stream( arr )       // Generating a stream of the `int` values held in the array.
            .boxed()             // Auto-boxing `int` primitives to `Integer` objects.
            .collect( Collectors.toCollection( TreeSet::new ) )  // Passing the `Integer` objects into a `TreeSet` to (a) eliminate duplicates, and (b) sort them.
        )
        .stream()
        .mapToInt( i -> i )
        .toArray();
}
}