Q:

Conversion of arrays in java

Assume we have an array of integers, say int[] x={0,1,2,3};
Can I convert x into an array of type String?
Can I upcast x into an array of doubles?
By the above conversions, I mean converting all entries of the array collectively, not individually. 
How do generally conversions work for arrays in java? Do I have to convert each entry of the original array and assign it to the corresponding entry of the target array?

A:

With Java 8 it is possible in one line you can do this
int[] x = {0,1,2,3};
double[] doubles = Arrays.stream(x).asDoubleStream().toArray();

A:

To convert int into string array you can use Stream
String[] strinArray=  Arrays.Stream(nums).mapToObj(String::valueOf).toArray(String[]::new); //where nums is int array

another way is 
String[] strinArray = Arrays.toString(nums).replaceAll("[\\[\\]]", "").split("\\s*,\\s*");

To convert int into double you can use below snippet 
double[] doubles = Arrays.stream(nums).asDoubleStream().toArray();

Note : Above code will work in java 8 only

A:

In java8 you can do:
    int[] x = {0,1,2,3};
    // int to double
    double[] doublesArray = Arrays.stream(x).asDoubleStream().toArray();
    //int to string
    String[] stringArray = Arrays.stream(x).mapToObj(String::valueOf).toArray(String[]::new);
    // string to double
    double[] doublesArrayFromString = Arrays.stream(stringArray).mapToDouble(Double::valueOf).toArray();

    Arrays.stream(doublesArray).forEach(System.out::println);
    Arrays.stream(stringArray).forEach(System.out::println);
    Arrays.stream(doublesArrayFromString).forEach(System.out::println);

Here's running code.

