作者TonyQ (骨头)
站内java
标题Re: [问题] 10进位转16进位不用内建变数的方法
时间Fri Feb 17 04:46:10 2006
※ 引述《nothao (hao)》之铭言:
: 我试过用
: while(a >0 )
: {
: r=a%16;
: stm=String.valueOf(r)+stm;
: a=a/b;
^ 这个B是甚麽?? 进位的数字吗??
那为甚麽上面是a%16 下面是 a/b
: }
: 但是却会出现 a=16时,stm=10 我知道可能是因为除後stm直接等於10
: 可是我不懂该如何做出例如stm=a的效果
: ps.如果是用switch的话,这个我会
十六进位的话 数字16 进位後的确是等於 "10" 啊@@
有甚麽问题吗??
int a=16;
System.out.println(Integer.toHexString(a));
出来的结果也是 "10"
stm不是16进位的String吗??
要让stm等於十进位的a值 那为甚麽要做转换?? @@
--
看完这一整个题目整个觉得莫名奇妙QQ
Local save
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.pratice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.138.240.60