online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
public class Main{ public static void main(String[] args){ int[] nums = {1}; int smn = 2; for(int i=0;i<50;i++){ String bsr=toBin(nums[i]); int[] runs={}; char r = '1'; int run = 1; for(int j=1;j<bsr.length();j++){ if(bsr.charAt(j)==r){ run++; } else { runs = append(runs, run); run=1; r=bsr.charAt(j); } } runs = append(runs, run); bsr=""; for(int j=0;j<runs.length;j++){ bsr+=toBin(runs[j]); } int nnum = toTen(bsr); if(!check(nums, nnum)){ nums=append(nums, nnum); } else { while(check(nums, smn)){ smn++; } nums=append(nums, smn); } System.out.print(nums[i+1]); System.out.print(","); } } public static String toBin(int x){ String opt=""; int ix=x; while(ix!=0){ if(ix%2==0){ ix=ix/2; opt="0"+opt; } else { ix--; ix=ix/2; opt="1"+opt; } } return opt; } public static int toTen(String x){ int opt=0; int mpr=1; for(int i=x.length()-1;i>-1;i--){ if(x.charAt(i)=='1'){ opt+=mpr; } mpr=mpr*2; } return opt; } public static int[] append(int[] l, int a){ int[] opt= new int[l.length+1]; for(int i=0;i<l.length;i++){ opt[i]=l[i]; } opt[l.length]=a; return opt; } public static boolean check(int[] arr, int toCheckValue){ boolean test = false; for (int element : arr) { if (element == toCheckValue) { test = true; break; } } return test; } }

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