@ElderGeek
You have to do it element by element and store the new elements in your new array. e.g.
-
Double[] convert(float[] f) {
-
-
Double[] d= new Double[f.length];
-
for (int i= 0; i < f.length; i++)
-
d[i]= new Double(f); // convert any way you like
-
return d;
-
}
-
Arrays of type D can't be cast to an array of type B, not even when type D extends type B (a D 'is a' B). Here is a small example that shows why you can't do it:
-
public class Animal { ... }
-
public class Poodle extends Animal { ... }
-
public class Lion extends Animal { ... }
-
-
Poodle[] poodles = { /* cute little poodles in here */ };
-
Animal[] animals= (Animal[])poodles; // this is not allowed because:
-
animals[0]= new Lion(); // the poodles won't survive ;-)
-
kind regards,
Jos