Lets say there is an array like this:
double [] numbers = new double[] {1,1,2,2,5,7,7,7};
I want to copy only the different numbers to a new array (the result should be numbers = {1,2,5,7}) in a time efficient way. I know how to do it in a time inefficient way - by looking if the next number is the same as the one before and continuing the copy loop if they are. Is there another way?