GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java/Conversions/OctalToBinary.java at master · loullfly/Java Expand file tree/ Copy pathOctalToBinary.javaMore file actions 49 lines (42 loc) · 994 Bytes / Copy pathOctalToBinary.javaFile metadata and controls49 lines (42 loc) · 994 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 import java.util.Scanner; /** * Converts any Octal number to a Binary number * * @author Zachary Jones * */ public class OctalToBinary { /** * Main method * * @param args Command line arguments */ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int o = sc.nextInt(); System.out.println("Binary equivalent: " + convertOctalToBinary(o)); sc.close(); } /** * This method converts an octal number * to a binary number. * * @param o The octal number * @return The binary number */ public static int convertOctalToBinary(int o) { Scanner scan; int num; void getVal() { System.out.println("Octal to Binary"); scan = new Scanner(System.in); // Entering the needed number System.out.println("\nEnter the number : "); num = Integer.parseInt(scan.nextLine(), 8); } void convert() { String binary = Integer.toBinaryString(num); System.out.println("Binary Value is : " + binary); } } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |