CSE 8A Midterm: CS Midterm 2 Review Slide Study Notes

48 views4 pages

Document Summary

// the following method flips the image horizontally and vertically public void flip() { Pixel[] pixel = this. getpixels(); for(int i = 0; i < pixel. length / 2; i++) { Pixel other = pixels[pixels. length - i - 1]; Bit shifting and binary numbers num >> n: this means shift bits in num to the right n bits. Basically, divide num by 2^n num << n: this means shift bits in num to the left n bits. Basically, multiply num by 2^n num % 2^n gets the least significant n bits of num. To get n most significant bits in num, use num >> 8 - n. // first, we clear of the bits that we don"t need, then we modulus to get the. // 1 << n is the same as 2^n return (num >> start) % (1 << n); To make something sound 2x faster, we have to get every other sound.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers