Created
February 9, 2012 14:58
-
-
Save pawitp/1780483 to your computer and use it in GitHub Desktop.
This file contains 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.Scanner; | |
public class HexToDecWithBonus { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
System.out.print("Enter hex: "); | |
int dec = in.nextInt(16); | |
System.out.println("Decimal: " + dec); | |
System.out.println("Binary: " + Integer.toBinaryString(dec)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment