Conversion from Long to Double in Java

前端 未结 8 520
隐瞒了意图╮
隐瞒了意图╮ 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:45

    You could simply do :

    double d = (double)15552451L;
    

    Or you could get double from Long object as :

    Long l = new Long(15552451L);
    double d = l.doubleValue();
    

提交回复
热议问题