Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int ps(){
- int sp = Integer.parseInt(iw.get(2)[1].trim()), c = 0;
- List<Integer> col1 = new ArrayList<>();
- List<Integer> col2 = new ArrayList<>();
- for (int y = 0; y < Psize; y++) {
- if( (y+sp) >= Psize){
- for (int x = 0; x < Rsize; x++) {
- if (tt[x][y] != null) {
- List templist = (List) tt[x][y];
- for (int j = 0; j < templist.size(); j++) {
- col1.add((int) templist.get(j));
- }
- }
- for(int y2=y+1; y2<Psize; y2++){
- if (tt[x][y2] != null) {
- List templist2 = (List) tt[x][y2];
- for (int i = 0; i < templist2.size(); i++){
- col2.add((int) templist2.get(i));
- }
- }
- }
- }
- for (int a = 0; a < col1.size(); a++) {
- for (int b = 0; b < col2.size(); b++) {
- c += Integer.parseInt(aa.get(col1.get(a))[col2.get(b)].trim());
- }
- }
- col1.clear();
- col2.clear();
- }
- else{
- for (int x = 0; x < Rsize; x++) {
- if (tt[x][y] != null) {
- List templist = (List) tt[x][y];
- for (int j = 0; j < templist.size(); j++) {
- col1.add((int) templist.get(j));
- }
- }
- for(int y2=y+1; y2<(y+sp); y2++){
- if (tt[x][y2] != null) {
- List templist2 = (List) tt[x][y2];
- for (int i = 0; i < templist2.size(); i++){
- col2.add((int) templist2.get(i));
- }
- }
- }
- }
- for (int a = 0; a < col1.size(); a++) {
- for (int b = 0; b < col2.size(); b++) {
- c += Integer.parseInt(aa.get(col1.get(a))[col2.get(b)].trim());
- }
- }
- col1.clear();
- col2.clear();
- }
- }
- System.out.println("Period Spread: "+c);
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement