Bits n Bytes

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Scanner; class Main { public static void main(String[] args) { String LinefromInput; String finalhexmessage =""; String finalhexmessage =""; String finalhexmessage =""; String finalhexmessage =""; while (s.hasNextLine()){ int decimal; String binary; String hex; //String hexanswer; Scanner s = new Scanner (System.in); LinefromInput= s.nextLine(); finalhexmessage = hex = s.nextLine(); finalDecimalMessage = s.nextLine(); // hex = hex.replaceAll("0", "0000 "); // hex = hex.replaceAll("1", "0001 "); // hex = hex.replaceAll("2", "0010 "); // hex = hex.replaceAll("3", "0011 "); // hex = hex.replaceAll("4", "0100 "); // hex = hex.replaceAll("5", "0101 "); // hex = hex.replaceAll("6", "0110 "); // hex = hex.replaceAll("7", "0111 "); // hex = hex.replaceAll("8", "1000 "); // hex = hex.replaceAll("9", "1001 "); // hex = hex.replaceAll("A", "1010 "); // hex = hex.replaceAll("B", "1011 "); // hex = hex.replaceAll("C", "1100 "); // hex = hex.replaceAll("D", "1101 "); // hex = hex.replaceAll("E", "1110 "); // hex = hex.replaceAll("F", "1111 "); decimal= Integer.parseInt(hex, 16); binary = Integer.toBinaryString(decimal); System.out.println("HEXIDECIMAL MESSAGE:" + hex); System.out.println("DECIMAL CONVERSION: " + decimal ); System.out.println("Binary CONVERSION: " + binary); StringBuilder output = new StringBuilder(""); for ( int i = 0; i <hex.length(); i += 2){ System.out.println(i + " ASCII CONVERSION: " + (char)i); } /* for ( int i = 0; i <255; i++){ System.out.println(i + " " + (char)i); */ } } }
Editor Settings
Theme
Key bindings
Full width
Lines