CS 15-121 Introduction to Data Structures Lab 8 Copy the following code and follow the instructions in the comments: ******************************************************************************************************* import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Test { //Read about bits and bitwise operators here : https://en.wikipedia.org/wiki/Bitwise_operation //Draw a truth table like below on paper: // A B AandB AorB AxorB // 0 0 // 0 1 // 1 0 // 1 1 //provide a body for the below method that will convert a given decimal number to binary and print it out public static void converttoBinary(int num){ //you can find the steps here : http://www.wikihow.com/Convert-from-Decimal-to-Binary } public static void main(String a[]) throws FileNotFoundException, IOException { converttoBinary(8); converttoBinary(23); FileInputStream in = null; try { //Create a text file and input a series of characters into it. in = new FileInputStream("path to your text file"); //your previously defined file goes here //read each byte from the file, using the read() method, and print out all the bits that make it up, along with the ASCII code of it. //eg: if my file contained the text ABCGDAbK , then the output would be: //A 65 01000001 //B 66 01000010 //C 67 01000011 //G 71 01000111 //D 68 01000100 //A 65 01000001 //b 98 01100010 //K 75 01001011 } finally { if (in != null) { in.close(); } } } }