package main;

public class SequenceAligner {

	private int gCost = -2;
	private int mCost = 1;
	private int bCost = -1;


	public void alignment(String x, String y){

		int[][] matchings = initializeMatchingArray(x, y);


	}



	private int[][] initializeMatchingArray(String x, String y) {
		int[][] matchings = new int[x.length()][y.length()];
		for(int i = 0; i < x.length(); i++){
			matchings[i][0] = gCost;
		}
		for(int i = 0; i < y.length(); i++){
			matchings[0][i] = gCost;
		}

		return matchings;
	}



	public static void main(String[] args){
		SequenceAligner sa = new SequenceAligner();
		sa.alignment("good", "bad");

	}
}

@@ -115,16 +115,87 @@
  = -1;%0A%0A
+%09public int alpha(char x,char y)%7B%0A%09%09return x == y ? mCost : bCost;%0A%09%7D%0A%0A
 %0A%09public
@@ -286,20 +286,383 @@
 x, y);%0A%0A
+%09%09for(int j = 1; j %3C x.length()+1; j++)%7B%0A%09%09%09for(int i = 1; i %3C y.length()+1; i++)%7B%0A%09%09%09%09char a = x.charAt(j-1);%0A%09%09%09%09char b = y.charAt(i-1);%0A%09%09%09%09int optimal = Math.max(Math.max(alpha(a,b) + matchings%5Bj-1%5D%5Bi-1%5D, gCost + matchings%5Bj-1%5D%5Bi%5D), gCost + matchings%5Bj%5D%5Bi-1%5D);%0A%09%09%09%09matchings%5Bj%5D%5Bi%5D = optimal;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09System.out.println(matchings%5Bx.length()%5D%5By.length()%5D);%0A%0A
 %0A%09%7D
-%0A
 %0A%0A%0A%09priv
@@ -751,32 +751,34 @@
 w int%5Bx.length()
++1
 %5D%5By.length()%5D;%0A%09
@@ -773,16 +773,18 @@
 length()
++1
 %5D;%0A%09%09for
@@ -801,32 +801,34 @@
 ; i %3C x.length()
++1
 ; i++)%7B%0A%09%09%09match
@@ -836,24 +836,26 @@
 ngs%5Bi%5D%5B0%5D = 
+i*
 gCost;%0A%09%09%7D%0A%09
@@ -884,16 +884,18 @@
 length()
++1
 ; i++)%7B%0A
@@ -915,16 +915,18 @@
 0%5D%5Bi%5D = 
+i*
 gCost;%0A%09
@@ -1062,19 +1062,32 @@
 nt(%22
-good%22, %22bad
+GATCGGCAT%22, %22CAATGTGAATC
 %22);%0A

Correct numbers be here