Created
September 28, 2017 06:44
-
-
Save ZacBlanco/aefea2808b11c345d40e6a55683577d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class myclass { | |
| static boolean recursion_proper = false; | |
| static int original_input = 123123123; | |
| static int recursion_count = 0; | |
| public static void main(String[] args) { | |
| System.out.println("Hello, World!"); | |
| DecToBin(Integer.parseInt(args[0])); | |
| System.out.println("Recursion called properly: " + recursion_proper); | |
| System.out.println("DecToBin called " + recursion_count + " times"); | |
| } | |
| public static String DecToBin(int x){ | |
| if (x > 0 && (original_input / x) % 2 == 0) | |
| recursion_proper = true; | |
| recursion_count++; | |
| return StudentImplDecToBin(x); | |
| } | |
| public static String StudentImplDecToBin(int x){ | |
| if (x > 0){ | |
| String s = DecToBin(x/2); | |
| return s + (x % 2); | |
| } | |
| return ""; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment