conversion between the binaries
Conversion between binaries in Java, decimal to binary, octal, hex. Other binary decimal.
What about the conversions between these binaries?
Read the question:
The Write function outputs a decimal number to its corresponding octal number.
Sample input
9274
Sample output
22072
Code:
import java.util.*;
Public class Shizhuanba {
Public Static void Main (string[] args)
{
Scanner in =new Scanner (System. in);
int a=in.nextint ();
Integer.tooctalstring (a);
System. out. println (Integer. Tooctalstring(a);
}
}
Summary: Binary, octal, decimal, 16 binary conversion
A: Decimal Conversion Other
Decimal conversion Binary
Integer.tobinarystring (i);
Decimal conversion octal
Integer.tooctalstring (i);
Decimal conversion hexadecimal
Integer.tohexstring (i);
B: Other binary conversion decimal
Binary Conversion Decimal
Integer.valueof ("1010", 2). ToString ();
Octal Conversion Decimal
Integer.valueof ("8"). ToString ();
16 Binary Conversion Decimal
Integer.valueof ("ABCDEF", +). toString ();
This is in Java programming commonly used in the conversion, I hope to help you!
Conversion between the binaries