How to cast an array to an array with another primitive type

Posted by Martijn Courteaux on Stack Overflow See other posts from Stack Overflow or by Martijn Courteaux
Published on 2010-04-14T17:59:59Z Indexed on 2010/04/14 18:13 UTC
Read the original article Hit count: 276

Hi,

Can someone complete the code on an easy way?

float[] floats = {...}; // create an array
// Now I want to create a new array of ints from the arrays floats
int[] ints = ????;

I know I can simply cast element by element to a new array. But is it possible on an easier way?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about primitive-types