Question

Here is my code:

float e[10]=new float[10];

Is there any way to format all the 10 floats into a format string? Maybe something like this in Python:

a=range(10)
print ('#'+'(%f)'*10+'#')%tuple(a)

Is there a method like this in java? I mean getting a string like "#(1.0)(2.0)(3.0)#" for the case of array_size 3.

Was it helpful?

Solution

float e[10]=new float[10];
System.out.println(Arrays.toString(e));

Try this

OTHER TIPS

Try this , make a loop to the end of the array and parseFloat to a String msg

 String msg = "";
 float[] e= new float[10];
 for(int i=0;i<e.length();i++){
    msg = msg + Float.parseFloat(e[i]);
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top