Created
December 27, 2012 01:09
-
-
Save yujuwon/4384581 to your computer and use it in GitHub Desktop.
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
public class App implements Runnable | |
{ | |
private static long[] longArray = {0x000000A00000000Dl, 0x0000000B000000C0l}; | |
private volatile long longValue; | |
public App(){ | |
} | |
public static void main( String[] args ) | |
{ | |
App test = new App(); | |
Thread t1 = new Thread(test); | |
Thread t2 = new Thread(test); | |
t1.start(); | |
t2.start(); | |
} | |
public void run() { | |
int i = 0; | |
int length = longArray.length; | |
while (true) { | |
longValue = longArray[i % length]; | |
// System.out.println(longValue); | |
i = (i < length) ? i + 1 : 0; | |
checkValue(longValue); | |
} | |
} | |
private void checkValue(long l) { | |
for (int i = 0; i < longArray.length; i++) { | |
if (l == longArray[i]) { | |
return; | |
} | |
} | |
System.out.println(l + "값이 다릅니다. "); | |
System.exit(-1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment