How do I convert "stringWithFormat" in Java?

I need an equivalent java code for the instruction below:

param1 = [NSString stringWithFormat:@"%f", (param2 - param3)];

      

where param1 is a string, param2 a double and param3 a float

+3


source to share


2 answers


You can use String.format("%f", param2 - param3)

(which is closer to the original code) or String.valueOf(param2 - param3)

(which is simpler).



+3


source


System.out.println (String.valueOf (param2 - param3));



0


source







All Articles