• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Page 21 "2^8 is 2x2="

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i think on page 21 is a Errata, there should be plus (+) instead of equal (=) signs:

2^8 is 2x2 = 4x2 = 8x2 = 16x2 = 32x2 = 64x2 = 128x2 = 256

should be

2^8 is 2x2 + 4x2 + 8x2 + 16x2 + 32x2 + 64x2 + 128x2 = 256

bye!
 
Marshal
Posts: 6974
471
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which book is that?

Muh Po wrote:should be

... 2x2 + 4x2 + 8x2 + 16x2 + 32x2 + 64x2 + 128x2 = 256


And how did you get 256 by proposing such calculation? I'm getting 508.
 
Liutauras Vilda
Marshal
Posts: 6974
471
Mac OS X VI Editor BSD Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2^8 is


That would be correct: 2^8 is 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 256, which I think same what book suggests, just slightly differently written, but idea is that.
 
Sheriff
Posts: 13569
223
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2 to the power 8 is multiplying two by itself eight times. It's all multiplication, no addition. In other words,

2^8 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2


If you break it down and get intermediate results, then you might write this:

2^8 ==> 2 x 2 = 4 x 2 = 8 x 2 = 16 x 2 = 32 x 2 = 64 x 2 = 128 x 2 = 256
        ^   ^       ^       ^        ^        ^        ^         ^
        1   2       3       4        5        6        7         8


You should read the "=" signs as "is" not "is equivalent to". That is, you'd read that as "2 times 2 is 4 times 2 is 8 times 2 is 16 times 2 is 32 times 2 is 64 times 2 is 128 times 2 is 256."

 
Muh Po
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:Which book is that?

Muh Po wrote:should be

... 2x2 + 4x2 + 8x2 + 16x2 + 32x2 + 64x2 + 128x2 = 256


And how did you get 256 by proposing such calculation? I'm getting 508.



The Book: OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808

Sorry i made at first a mistake, starting at 2x2, but now i corrected it and started with 1x2.

But now i understand what is meant in the book, what was written is not so mathematical correct.

What is meant is this:
(((((((2 * 2 = 4) * 2 = 8) * 2 = 16) * 2 = 32) * 2 = 64) * 2 = 128) * 2 = 256)

Staff note (Ganesh Patekar):

It's easier to identify the exact book you are referring, if you mention the author(s) or publisher name along with the book name. Since you're new here i edited the subject.

 
Marshal
Posts: 65108
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wlcome to the Ranch

Please copy exactly what the book said, using exactly the same notation; you may find it useful to use the ⁸ HTML tag for ⁸.
Many people write ^ thinking it is the exponentiation operator, but in Java® it isn't. It is bitwise exclusive or.Java® doesn't have an exponentiaton operator; I don't know whether the bitwise operators will appear in your exam.
 
Muh Po
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Wlcome to the Ranch

Please copy exactly what the book said, using exactly the same notation; you may find it useful to use the ⁸ HTML tag for ⁸.
Many people write ^ thinking it is the exponentiation operator, but in Java® it isn't. It is bitwise exclusive or.Java® doesn't have an exponentiaton operator; I don't know whether the bitwise operators will appear in your exam.



Yes you're right, thank you!
I meant the exponential Operator, not the XOR-Operator.

I have corrected it.
 
Campbell Ritchie
Marshal
Posts: 65108
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found an old post where I explained how some of the bitwise operators work.
 
Campbell Ritchie
Marshal
Posts: 65108
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this is another way to look at 2 to the power of 8, 2⁸:-I suggest it would be a good idea for you to learn the smaller powers of 2 off by heart.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!