Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class testBases{
- public static void main(String[]argv){
- convert(args[0], args[1]);
- }
- public static String convert(int number, int base){
- int quotient = number/base;
- int remainder = number%base;
- if (quotient == 0){
- return Integer.toString(remainder);
- }
- else{
- return convert(quotient,base)+Integer.toString(remainder);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement