ADM-201 dump PMP dumps pdf SSCP exam materials CBAP exam sample questions

《迪哥Java教程》#4 计算机是怎么存储数字的? – 译学馆
未登录,请登录后再发表信息
最新评论 (0)
播放视频

《迪哥Java教程》#4 计算机是怎么存储数字的?

How do computers store numbers? - 004

计算机具有强大的数字处理能力 通常是这样
We know computers are great with numbers …usually
但计算机是如何存储数字的呢?有人会说:“0和1”
But how does a computer store numbers. Some of you might answer we use zeros and ones.
非常棒!但0和1又是如何组织在一起的呢?啊哈!
That’s right! But how those zeros and ones organized? Ah ha!
怎么用0和1表示其他数字呢?
How do we make numbers out of the zeros and ones?
这些正是本节课要学习的
That’s what this lessons about.
这节课的目的是
The goals for you for this lesson are to
理解用二进制或十六进制表示数字
understand how numbers represented using binary and hexadecimal.
以及java中是如何存储数字的
We also want to look at how Java store’s numbers.
这些将会帮我们理解不同的基本数据类型
This will help us understand the different primitive number types.
Java中可以用来存值的第一种数字类型是计数用的数字
The first type of number we can store in Java are the counting numbers.
它们是你最熟悉的数字
These should be the numbers that your most familiar with.
1 2 3 等等
One, two, three etc.
这些数字也包括0和负数
These numbers also include the number zero and negative numbers.
计数的数字有时也被叫做整数集
The counting numbers are sometimes called the set integer numbers.
这些数字沿着数轴正和负方向无限增长
These numbers go on for ever in both positive and negative direction.
在计算机中 不论怎样去构造数字 都无法表示每一个数字
On a computer you can’t represent every number no matter how you construct the number.
最终在计算机上会运行出一个空间溢出的结果
Eventually you’re gonna run outta space on a computer.
你能使用的合法的数字集合受限于Java基本数据类型的取值范围
The set of valid numbers that you can use is limited in something we call a Java primitive.
原因很简单
The reason for this is simple.
计算机中用一比特来存储0或1中的一个
In a computer a bit is used to store a value of either a zero or a one.
这是最小的信息片段
This is the smallest piece of information.
如果需要大一些的信息片段 就需要把许多个比特排列到一起
If you want bigger pieces of information, you need to string more bits together.
你首先想到的可能是把许多个1放到一起 数它们的个数
Your first thought might be, string more ones together and just count them.
对12来说 为了表示它会有许多个1
So for twelve, that’s a lot of ones just to represent twelve.
设想如果你要表示一个更大的数比如42 或一百万
Imagine if you wanted a bigger number like 42 or a million.
这种方式就不能用了
That plan’s not going to work.
思考下如何用十的幂次方表示十进制数
Think about how you represent decimal numbers based on powers of tens.
十进制数字每一位位权以10的幂次方递增
A decimal number increases by powers of ten for each decimal place.
所以123 = 1 ×100 + 2 × 10 + 3 ×1
So 123, equals one times a hundred plus, two times ten, plus three times one.
实际上是
This is really one times ten to the power
1 × 10² + 2 × 10¹ + 3 × 10º
of two, plus two times ten to the power of one, plus three times ten to the power zero.
现在看起来可能不一样 但这是你小时候学的十进制
Now it might not look like it, but this is the decimal system that you learned when you were a kid.
让我们用二进制数字在计算机里做同样的事情
We do the same thing for binary numbers in a computer.
跟十进制类似 二进制基于二的幂次方
Like a decimal place we have binary places based on powers of two.
所以在二进制中表示12 可以用
So to represent twelve in binary, we have one times eight plus one
1 × 8 + 1 × 4 + 0 × 2 + 0 × 1
times four, plus zero times two, plus zero times 1.
8 4 2 1都是二的幂次方
Eight, four, two, and one are all powers of two.
和十进制中的表示方式类似
So the same way we represent
你可以以二进制形式把12写成1100
decimal numbers, you can write twelve as 1100 in binary.
即使二进制以这种让人发疯形式存在
Even binary numbers organized this way can get crazy.
如你所见 需要用四个数字代表12
As you can see, we needed four digits to represent twelve.
随着二进制数字变得越来越大 我们通常会转变到第二个进制系统 16进制
As numbers get large in binary, we typically switch to a secondary number system called hexadecimal.
这个计数系统基于16的幂次方
This number system is based on powers of sixteen.
用字母来代替超过9的数字
And we use letters for the digits beyond 9.
你可能会问为什么是16?它不是随意的数字
You’re probably wondering why sixteen? It’s not a random number.
每个16进制数字其实都代表了4个二进制数字
Each hexadecimal digit is really a block of four binary digits.
二进制的1010 是16进制中的A
So binary 1010, is hexadecimal A,
或10进制中的10 挺酷的吧!
or ten in decimal. Pretty cool, huh?
嘿 感谢收看
Hey thanks for watching the video!
如果你想检查这节课你学了多少DeegeU.com上有一个快速测试
There’s a quick quiz for this on DeegeU.com if you’d like to gauge how much you learned.
如果你喜欢这个视频系列
If you like the videos you are seeing,
顶这个视频然后点击youtube DegeeU频道上的订阅按钮 来让我知道
please let me know by liking the video and hitting the subscribe button to the DeegeU channel on YouTube.
非常感谢!
I’d really appreciate that!
如果有任何疑问请在下面的评论或DeegeU.com的评论区留言
If you have concerns or questions please leave them in the comments below or on DeegeU.com.
DeegeU.com的首页有一个投票
There’s a poll on the front page in DeegeU.com,
可以让我知道下个视频中你想学习的内容是什么
so you can also let me know what topic is covered next.
感谢收看 下次再见
Thanks for watching and see you in the next video!

发表评论

译制信息
视频概述

通过十进制的例子,逐渐过度到二进制和十六进制的数字表示方法。

听录译者

收集自网络

翻译译者

谷子

审核员

萨默之光

视频来源

https://www.youtube.com/watch?v=4gE3FUPkm2U

相关推荐