long轉(zhuǎn)換為integer 關(guān)于BigInteger類型轉(zhuǎn)換成Long類型或int類型問題?
關(guān)于BigInteger類型轉(zhuǎn)換成Long類型或int類型問題?BigInteger bi = new BigInteger("123") int i = bi.intValue()
關(guān)于BigInteger類型轉(zhuǎn)換成Long類型或int類型問題?
BigInteger bi = new BigInteger("123") int i = bi.intValue() long l = bi.longValue() System.out.println(i) System.out.println(l)
BigDecimal怎么轉(zhuǎn)換成int或者Long?
很簡單,用intValue或者longValue方法即可。保證不超出int或long范圍 你的代碼修改成下面這種 for (DataRow objects : list) { BigDecimal accepPass=null accepPass=(BigDecimal)objects.get("ACCEP_PASS") int b=accepPass.intValue() int c=accepPass.longValue()System.out.println(b)//轉(zhuǎn)int System.out.println(c)//轉(zhuǎn)long } 有問題HI我或追問
java中如何把Integer轉(zhuǎn)換成Long?
可以使用Long包裝類的方法來進(jìn)行轉(zhuǎn)換,代碼如下:
Integer floatee//定義一個(gè)Integer類
floatee = Long.valueOf(floatstr)//valueof方法可以在內(nèi)部把Integer轉(zhuǎn)換成Long類型。
Long型的表示數(shù)據(jù)范圍比int類型打,所以可以進(jìn)行轉(zhuǎn)換。