Second parameter is base.
String sText = ""; Integer iValue; String sValue = ""; /* -- convert from dec */ sValue = Integer.toString( 100, 10 ); sText += "dec(100) to dec =" + sValue + "\n"; sValue = Integer.toString( 100, 2 ); sText += "dec(100) to bin =" + sValue + "\n"; sValue = Integer.toString( 100, 16 ); sText += "dec(100) to hex =" + sValue + "\n"; sValue = Integer.toString( 255, 16 ); sText += "dec(255) to hex =" + sValue + "\n"; /* result */ memo.setText( sText );Output:
No comments:
Post a Comment