What is the modulo operator for longs in Java?

前端 未结 3 1379
清酒与你
清酒与你 2021-01-11 10:25

How do I find the modulo (%) of two long values in Java? My code says \'Integer number too large\' followed by the number I\'m trying to mod. I tried casting it to a long bu

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-11 10:37

    The % operator does work for longs. It sounds like you may have forgotten to stick L at the end of a numeric literal, as in 123456789L. Can we see your code?

提交回复
热议问题