This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.javafun.example.atmstatusfsm; | |
import java.awt.BorderLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.util.List; | |
import javax.swing.JButton; | |
import javax.swing.JComboBox; | |
import javax.swing.JFrame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BitDemo1 { | |
/** | |
* prints "2" | |
*/ | |
public static void main(String[] args) { | |
int val = 0x2222; | |
int bitmask = 0x000F; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BitwiseShiftOperations { | |
/** | |
* Shift Operations Example | |
*/ | |
public static void main(String[] args) { | |
int val = 0x000F; | |
printBinary(val); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Problem: Given an integer, i, find whether it can be expressed as 2^k. Where k< i | |
*/ | |
class PowerOf2Util1 { | |
/** | |
* Test | |
*/ | |
public static void main(String[] args) { | |
int input = 262144; // 2^18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Problem: Given an integer, i, find whether it can be expressed as 2^k. Where k< i | |
*/ | |
class PowerOf2Util2 { | |
/** | |
* Test | |
*/ | |
public static void main(String[] args) { | |
int input = 262144; // 2^18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Problem: Given an integer, i, find whether it can be expressed as 2^k. Where k< i | |
*/ | |
class PowerOf2Util3 { | |
/** | |
* Test | |
*/ | |
public static void main(String[] args) { | |
int input = 262144; // 2^18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Problem: Given an integer, i, find whether it can be expressed as 2^k. Where k< i | |
*/ | |
class PowerOf2Util4 { | |
/** | |
* Test | |
*/ | |
public static void main(String[] args) { | |
int k=18; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.LinkedList; | |
import java.util.Map; | |
import java.util.Stack; | |
import java.util.Queue; | |
import java.util.Collections; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* What is printed to standard output ? | |
* | |
* a) "NullPointerException thrown" | |
* b) "Exception thrown" | |
* c) "Done with exceptions" | |
* d) "checkResult is done" | |
* e) None of the above | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* What will be printed to standard output? | |
* | |
* a) The code will not compile. | |
* b) The code compiles and "5, Super" is printed to standard output. | |
* c) The code compiles and "5, Sub" is printed to standard output. | |
* d) The code compiles and "2, Super" is printed to standard output. | |
* e) The code compiles and "2, Sub" is printed to standard output. | |
* f) The code compiles, but throws an exception. | |
*/ |
OlderNewer