# Class 10: Binary Representation of Integers

Back to Numeric Values in Java. On to Conditionals.

Held: Tuesday, February 7, 2006

Summary: Today we investigate the binary representation of integers.

Related Pages:

• Read Espresso: Conditionals in Java (available this afternoon).

• Finish any labs you have not yet finished.

• Notes:

• Remember: No programming homework for Wednesday.
• I have significantly rearranged the schedule of topics for the first five weeks.
• I don't expect you to be able to read the Sun Javadoc in depth. Rather, I expect you to be able to scan it for methods that might be useful. I also want you to be used to looking at it for help or ideas.

Overview:

• Remaining issues from numbers.
• Basics of binary representation.
• Lab.

## Numbers Lab, Concluded

• Are there any remaining questions or observations from the lab on numbers in Java?
• Finish that lab if you have not done so.

## Basics of Binary Representation

• Everything is represented as a series of 0's or 1's.
• For non-negative integers, easy technique: base-2.
• For integers that can be negative or positive, use two's complement: To negate, flip bits and add 1.
• Questions?

## Lab on Binary

• Do the lab.
• Be prepared to reflect.

Back to Numeric Values in Java. On to Conditionals.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue May 9 08:31:30 2006.
The source to the document was last modified on Thu Jan 12 14:58:06 2006.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2006S/Outlines/outline.10.html`.

You may wish to validate this document's HTML ; ; Check with Bobby

Samuel A. Rebelsky, rebelsky@grinnell.edu