Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 0.37 KB | Hits: 26 | Expires: Never
Copy text to clipboard
  1.         public static String changeBase (int org, int base) {
  2.                 int tF=org;
  3.                 Boolean passer=true;
  4.                 String result="";
  5.                 while (passer) {
  6.                         if (tF / base < 1) {
  7.                                 result=clean(tF % base)+result;
  8.                                 passer=false;
  9.                         } else {
  10.                                 result=clean(tF % base)+result;
  11.                                 tF=(tF - (tF % base))/base;
  12.                         }
  13.                 }
  14.                 if (result.equals("")) { result=""+org; }              
  15.                 return result;
  16.         }