Skip to content

Instantly share code, notes, and snippets.

@eienf
Created May 16, 2013 15:46
Show Gist options
  • Save eienf/5592709 to your computer and use it in GitHub Desktop.
Save eienf/5592709 to your computer and use it in GitHub Desktop.
convert Input : decimal number to the specific radix number string.
class Convert {
public static void main(String args[]) {
if ( args.length < 2 ) {
throw new IllegalArgumentException("parameter : decimal radix");
}
int decimal = Integer.parseInt(args[0]);
int radix = Integer.parseInt(args[1]);
String s = Integer.toString(decimal,radix);
System.out.println("result = "+s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment