Conversion from Long to Double in Java

前端 未结 8 419
隐瞒了意图╮
隐瞒了意图╮ 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();
    
    0 讨论(0)
  • 2021-01-31 01:45

    I think it is good for you.

    BigDecimal.valueOf([LONG_VALUE]).doubleValue()

    How about this code? :D

    0 讨论(0)
提交回复
热议问题