There are methods such as searching for duplicates but I wonder if there is a better solution for this task.
You may use streams for that.
streams
double[] array = new Random().doubles() .distinct() .limit(500) // How many you want. .toArray();