See if this solution works for you, it works for me:
public class Test
{
public static double[] exercici2(double[] a)
{
Vector<Double> tmp = new Vector<>();
for(int i = 0; i < a.length; i++)
{
boolean found = false;
for(int j = 0; j < tmp.size(); j++)
{
if(tmp.get(j).doubleValue() == a[i])
found = true;
}
if(!found)
tmp.add(a[i]);
}
double ret[] = new double[tmp.size()];
for(int i = 0; i < tmp.size(); i++)
{
ret[i] = tmp.get(i);
}
return ret;
}
public static void main(String[] args)
{
double[] arraynigga = {3, -5, 2.4, 0, -5, 17, 3};
double[] a = exercici2(arraynigga);
System.out.print("{3, -5, 2.4, 0, -5, 17, 3} -----> ");
System.out.print("{");
for(int i = 0; i < a.length; i++)
{
if(i != 0)
System.out.print(", ");
System.out.print(a[i]);
}
System.out.print("}");
}
}