Hexadecimal conversion :

Basics :

​ The number used in binary is :0/1

​ The number used in octal is :0/1/2/3/4/5/6/7

​ The decimal number is :0/1/2/3/4/5/6/7/8/9

​ The number used in hexadecimal is :0/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15

​ -> because 10 The above is not a good indication ,10/11/12/13/14/15 Use letters to indicate a/b/c/d/e/f

​ -> So the hexadecimal number is expressed as :0/1/2/3/4/5/6/7/8/9/a/b/c/d/e/f

  • Binary to decimal
 Take a chestnut : a=100110;
Then the decimal system is (2^0x0)+(2^1x1)+(2^2x1)+...+2^5x1=0+2+4+0+0+32=38
  • Octal to decimal
 Take a chestnut : a=345
Then the decimal system is (8^0x5)+(8^1x4)+(8^2x3)=5+32+64x3=229
  • Hexadecimal to decimal
 Take a chestnut : a=6af
Then the decimal system is (16^0x15)+(16^1x13)+(16^2x6)=15+16x13+16x16x6=1759
  • Convert decimal to hexadecimal or Convert decimal to octal or Convert decimal to binary
 Suppose the decimal number is : asdf/x //x It can be 16 or 8 or 2 It depends on why you convert 
if(?<x) be The result of the conversion is ?a
if(?>x) be Continue to divide ?/x=??....b;
if(?<x) be The result of the conversion is ??ba
if(?>x) be Continue to divide ??/x=???....c;
if(?<x) be The result of the conversion is ???cba
if(?>x) be Continue to divide No more examples ; Through the decimal system as a medium , Can achieve four base arbitrary conversion ;

Mengxin Xiaobai , It's possible that some aspects are not right , Welcome to correct ; We're going to be stronger together !

Beginners java System conversion to learn more related articles

  1. java Hexadecimal conversion ( Ignore the difference between positive and negative numbers )

    Recently, I took a look at the learning materials , In fact, it's very interesting to think about the conversion of Radix , Especially for negative numbers . Let's share with you , Only the decimal to binary conversion is written here , It's the same thing public class Test1 { pub ...

  2. Java Hexadecimal conversion , data type , Operator

    1: Hexadecimal conversion Conversion rules : First, multiply the coefficient of each bit of the data by the power of the corresponding radix ( Low order starts from zero ), And then add it up Decimal to other bases The rules : In addition to the base, take the remainder , Until Shang Wei 0, Finally, reverse the remainder Decimal to binary : except 2 Remainder , Until Shang Wei 0 ...

  3. Java Hexadecimal conversion ( Binary system ( negative ), octal , Decimal system , Hexadecimal ), An operation 、 Logical operations (2)

    The binary representation of negative numbers : In fact, the absolute value of the number is negated +1. Hexadecimal conversion ( Binary system , octal , Decimal system , Hexadecimal ), Principle analysis The representation of hexadecimal : (2)( And . Exclusive or . Move left . Move right . Ternary operator )

  4. Java Example of decimal conversion

    Collection code , In case of inquiry . The conversion between decimal system is based on decimal system . int os = 16; // Conversion from decimal to hexadecimal : Integer.toHexString(os); // Decimal to octal Integ ...

  5. java Base conversion code

    Define decimal numbers and write them directly , Definition 8 The number of decimal places 0 start , Define the number of binary 0b start , Define the number of hexadecimals 0x At the beginning, you need to express decimal number and binary number. You can refer to the following example : int a = 10; System.out.pr ...

  6. Java Hexadecimal conversion

    Other changes 10 Base number System.out.println(Integer.parseInt("10", 2));// bin System.out.println(Integer.pa ...

  7. java Hexadecimal conversion

    class Dec2XXX { public static void main(String[] args) { toBin(6); toHex(6); toOct(6); } /*10to2*/ p ...

  8. JAVA Basic learning is String、StringBuffer、StringBuilder、 Use of basic data types 、 Integer conversion 、 aggregate Collection、Vector、ArrayList、LinkedList、HashSet、TreeSet etc. (3)

    Main function class MainDemo.java package com.itcast.test20140109; import java.util.ArrayList; import java.util.Coll ...

  9. JavaSE Study ( Two ): Hexadecimal conversion — Data type conversion —Java Operator

    One . Hexadecimal conversion 1.1 Other decimal system to decimal system ( Take hexadecimal as an example ): Hexadecimal range :0-9, A-F Corresponding number 10-15 2A7E(16)  =  14*16(0) +7*16(1) + 10*16(2)  + ...

  10. Java One of the basic reviews : Guan Jianzi , identifier , notes , Constant , Hexadecimal conversion , Variable , data type , Data type conversion

    1. Guan Jianzi 1.1. By Java Words that are given a specific meaning by language ( Such as :class,interface,public ,static) 1.2. It's all lowercase 1.3. matters needing attention (goto and const Keep it as a key word ) ...

Random recommendation

  1. 【 Reprint 、 recommend 】 Don't call yourself a programmer , I've had it for more than ten years IT Career summary

    Notes and comments : After reading in one breath , Some of them are similar to my point of view . This article is obviously an old foreign writer , But it doesn't hinder our cross-border communication . If I could add a course to every engineering education , It doesn't involve compilers . Gate circuit or time complexity , It's an introduction to the reality of the industry , because ...

  2. loadrunner --global schedule Set up

  3. Leetcode Elemination Game

    Topic website :https://leetcode.com/contest/2/problems/elimination-game/ The question : Give a slave 1 To n Sequence of numbers , For the first time, from the far left , Every other number . ...

  4. AngularJs $animate Make the page move

    $animate $animate The service provides the basic DOM Operating functions such as in DOM Insert inside . Remove and move elements , And adding and deleting classes . The service is ngAnimate Core services , by CSS and Javascript It offers high-grade ...

  5. [Jquery] Jquery AutoComplete Example of how to use

    jQuery Of Autocomplete( Done automatically . Auto fill ) plug-in unit jquery-autocomplete To configure : <script type="text/javascript" ...

  6. mongoDB Type reference table

    $type Operators are based on BSON Type to retrieve the matching data types in the collection , And return the result . MongoDB The types that can be used in are shown in the following table : Reference material :http://www.runoob.com/mongodb/mong ...

  7. JSP Client request

    When a browser requests a web page , It will send a series of unreadable information to the network server , Because this information is for HTTP Part of the message header to transmit . You can refer to HTTP Agreement to get more information . The following table lists some important contents of the browser information header ...

  8. first sprint And the second sprint Stage summary

    On the whole : 1. Team work : The cooperation of the whole team is pretty good , Some players are more active and active , This is a better phenomenon , Because the ultimate goal of a team is vitality and unity , Or so I thought , If everyone in a team doesn't work , I think the consequences are unbearable ...

  9. Distributed timing task framework comparison ,spring batch, tbschedule jobserver

    Distributed timing task framework comparison ,spring batch, tbschedule jobserver | Mobile development reference book Distributed timing task framework comparison ,spring batch, tbschedule jobser ...

  10. bash Multiline comments for

    :<<EOF Annotated code ... EOF One way is #