This file contains hidden or 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 kishida.aparapisample; | |
import com.amd.aparapi.Kernel; | |
import java.util.Random; | |
import java.util.stream.IntStream; | |
/** | |
* | |
* @author kishida | |
*/ |
This file contains hidden or 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 ParseExp { | |
public static void main(String[] args) { | |
int n = 0; | |
String exp = "123+44-21"; | |
int s = 0; | |
int result = 0; | |
char opCh = '+'; | |
for(int i = 0; i < exp.length(); ++i){ | |
char ch = exp.charAt(i); | |
boolean num = ch >= '0' && ch <= '9'; |
This file contains hidden or 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 javaapplication1.beginer; | |
import java.util.LinkedList; | |
/** | |
* | |
* @author naoki | |
*/ | |
public class AaaParenthesis { | |
public static void main(String[] args) { |
This file contains hidden or 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 javaapplication1.beginer; | |
/** | |
* | |
* @author naoki | |
*/ | |
public class AaaParenthesisRecursion { | |
public static void main(String[] args) { | |
String aaa = "aaa(aaa(aa((aaa)aa))aa)a"; | |
for(int i = 0; i < aaa.length(); ++i){ |
This file contains hidden or 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 MulParseExp { | |
public static void main(String[] args) { | |
int n = 0; | |
String exp = "123+44*2-21"; | |
int s = 0; | |
int result = 0; | |
char opCh = '+'; | |
int mulNum = 1; | |
for(int i = 0; i < exp.length(); ++i){ |
This file contains hidden or 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 Add { | |
public static void main(String[] args) { | |
int a = 0b01100101; | |
int b = 0b00110110; | |
System.out.printf("a:%d b:%d a+b:%d%n", a, b, a + b); | |
int and = a & b; | |
System.out.printf("%8s(%d)%n", Integer.toBinaryString(a), a); | |
System.out.printf("%8s(%d)%n", Integer.toBinaryString(b), b); | |
System.out.printf("%8s(%d) xor%n", Integer.toBinaryString(a ^ b), a ^ b); |
This file contains hidden or 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 AddLogical { | |
public static void main(String[] args) { | |
int a = 231; | |
int b = 35; | |
System.out.printf("%d + %d = %d%n", a, b, a + b); | |
while(b != 0){ | |
int c = a ^ b; | |
b = (a & b) << 1; | |
a = c; | |
} |
This file contains hidden or 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.awt.FlowLayout; | |
import java.awt.GridLayout; | |
import java.awt.event.ActionListener; | |
import java.util.stream.Stream; | |
import javax.swing.JCheckBox; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
/** | |
* @author naoki |
This file contains hidden or 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 SingleThread { | |
public static void main(String[] args) { | |
StringBuilder sb = new StringBuilder(); | |
String str = "abc(cdef)gh(ijk)lmn"; | |
int i = 0; | |
boolean inParenthesis = false; | |
for(;;){ | |
if(i >= str.length()){ | |
break; | |
} |
This file contains hidden or 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.stream.Stream; | |
public class ThreadMulti { | |
static class Context{ | |
String str; | |
int i = 0; | |
boolean inParenthesis = false; | |
boolean terminated = false; | |
Context(String str){ | |
this.str = str; |