Mutual Convert between decimal and binary integer

sponsored links
Decimal binary transfer:
Divided by 2 was removed from the results of a
The remainder and the last one written from the bottom up is the result of such reverse 302
302 / 2 = 151 I 0
151 / 2 = 75 I 1
75 / 2 = 37 I 1
37 / 2 = 18 I 1
18 / 2 = 9 I 0
9 / 2 = 4 I 1
4 / 2 = 2 I 0
2 / 2 = 1 I 0
Therefore, the binary is 100 101 110

Decimal binary switch:
Starting from the last count, in turn classified as 0,1,2 ... place the first n-bit number (0 or 1) multiplied by 2 n-th power sum of the results obtained is the answer for example: 01101011. Turn metric :
Bit 0: 1 x 2 = 1 0 th power
1 x 2 1 th power = 2
0 x 2 2 power = 0
1 x 2 3 power = 8
0 x 2 4 th power = 0
1 x 2 5 th power = 32
1 by 2 ^ 6 = 64
0 x 2 7 th power = 0
Then: 1 +2 +0
+32 +64 +8 +0 +0 = 107.
Binary 01101011 = decimal 107.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Mutual Convert between decimal and binary integer

  • "Character Set Encoding" --- "coded character set," notes

    ANSI American National Standards Institute ANSI encoding is actually a generic term referring to the local operating system, the default encoding in the system under the Simplified Chinese, ANSI code on behalf of GB2312 encoding, in the Japanese operating

  • Turn: java application of the IP address of the string into an integer

    A range of applications tends to be used in the registry restrictions, find IP host cities such as demand, windows of the ping command also supports the integer form of IP. 2, the key technical point IP addresses into integers as follows: 1, through ...

  • Walk around turn mysql, sqlserver, oracle database, three kinds of large object access

    Original mysql, sqlserver, oracle three kinds of database access to large objects collection mysql large object access: Type in general should be mediumblod, blob can only be kept two of the 16 th power one byte, mediumblod is 24-th power, Generally ...

  • Java operator

    Java operators can be divided into four categories: arithmetic operators, relational operators, logical operators and bit operators. 1. Arithmetic Operators Java's arithmetic operators are divided into unary operators and binary operators. Unary opera

  • Javascript second day

    1, the target with the conversion between basic types: No matter when, but the object is not empty, in the environment for Boolean true. Such as; new Boolean (false); new Number (0); new String (""); new Array (); Although the internal value of

  • upload_dialog.js

    var Application = (); Application.uploadDialog = ( progressBarText: 'Uploading: (0), (1)% finish', statuBarText: 'File Number: (0), Size: (1)', fileQueued: function (file) ( var obj = Application.uploadDialog; var filetype = (file.typ ...

  • javascript Essays

    1, Scope Var statement using the definition of variables. When the variables in the function of the internal definition, var scope of a function (function-scope) level, this variable should not be accessed outside the function. JavaScript is not the ...

  • Ruby Operators Summary

    Personal sense of "Ruby Programming Language" is indeed a good book, it will have bits and pieces of the Ruby point up. Here, some of my experiences from their own point of Ruby language school operator to be a notebook-style summary. Welcome to

  • Ruby in the meaning of keywords

    1, break out of the cycle when the layer 2, next neglect the remainder of the cycle to begin the next cycle 3, redo a fresh start cycle, or the beginning of this first 4, retry to start the loop 5, $ array <<value to value as an array element add an

  • ruby

    class Exponentiate def initialize (x, n) @ m = n, @ z = x end def exponentiate @ power = 1 while (@ m> 0) while ((@ m% 2) == 0) @ m = @ m / 2 @ z = @ z * @ z end @ m-= 1 @ power = @ power * @ z end return @ power end end exp = Exponentiate.new (2, ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries