online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
import java.util.*; public class Main { public static void main(String[] args) { System.out.println(licensePlateNumber(1)); System.out.println(licensePlateNumber(100000)); System.out.println(licensePlateNumber(100001)); System.out.println(licensePlateNumber(100002)); // System.out.println(licensePlateNumber(175256)); } public static String licensePlateNumber(long val) { long pow10[] = new long[6]; long pow26[] = new long[6]; pow10[0] = 1; pow26[0] = 1; for (int i = 1; i <= 5; i++) { pow10[i] = (10*pow10[i - 1]); pow26[i] = (26*pow26[i - 1]); } for (int alphabets = 0; alphabets <= 5; alphabets++) { int digits = 5 - alphabets; long count = pow10[digits]*pow26[alphabets]; if (val <= count) { long ratio = val/pow10[digits]; if (val%pow10[digits] != 0) { ratio++; } //System.out.println("ratio " + ratio); val = val - (ratio - 1)*(pow10[digits]); return createString(ratio - 1, alphabets) + extraPad(val - 1, digits, '0'); } else { val = val - count; } } return ""; } public static String extraPad(long val, int digits, char ch) { //System.out.println(val + " " + digits + " " + ch); if (digits == 0) { return ""; } else { String str = Long.toString(val); while (str.length() < digits) { str = ch + str; } return str; } } public static String createString(long ratio, int alphabets) { // System.out.println(ratio + " " + alphabets); if (alphabets == 0) { return ""; } else { StringBuilder sb = new StringBuilder(); while (ratio != 0) { long rem = ratio%26; sb.append(findAlphabet((int)rem)); ratio = ratio/26; } String result = sb.reverse().toString(); while (result.length() < alphabets) { result = "A" + result; } return result; } } public static char findAlphabet(int index) { String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; return str.charAt(index); } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue