hi all, i have an array of float and i want to get the float values in term of string s (i.e.,converting my float array into string array)as i have to later use the string values to concate with few coeffs like x1,x2,x3..... and write a final formula to output file like total= (x1)(1.9312)+(x2)(1.5874)+......... where 1.9312 and 1.5874 are my float values in the float array which i wanna convert to string .help me out. thanx alot in advance
jason adam
Chicken Farmer ()
Ranch Hand
Joined: May 08, 2001
Posts: 1932
posted
0
Moving this to the Beginners forum
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
I'm not certain I've understood what you're trying to accomplish. It seems to me that you don't need to create an array of Strings from your array of floats, as you mentioned these values would simply be concatenated to other Strings later on. Well, you could simply just "add" the float values to these other String values with the + operator, much like concatenating Strings the ol' fashioned way.
If you want to control how they values are formatted, such as how many digits you want after the decimal point, look at the "java.text.DecimalFormat" class. If you don't do this, a value such as 2.00f might appear as 1.99999999999 because of how Java treats real numbers.