Conversion from Long to Double in Java

前端 未结 8 435
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 01:07

Is there any way to convert a Long data type to Double or double?

For example, I need to convert 15552451L to a

8条回答
  •  伪装坚强ぢ
    2021-01-31 01:24

    Long i = 1000000;
    String s = i + "";
    Double d = Double.parseDouble(s);
    Float f = Float.parseFloat(s);
    

    This way we can convert Long type to Double or Float or Int without any problem because it's easy to convert string value to Double or Float or Int.

提交回复
热议问题