Coded(String a, String b, String c)
{
this.a = a;
this.b = b;
this.c = c;
}
public int Search(int i, int j)
{
return this.sTable[j];
}
public int[] CrossSearch(int[] in)
{
int length = in.length;
int[] out = new int[length];
int Y = 5;
out[1] = Search(in[(length - 1)], Y);
out[3] = Search(in[(length - 3)], out[1]);
out[0] = Search(in[(length - 2)], out[3]);
out[2] = Search(in[(length - 4)], out[0]);
if (length == 6)
{
out[5] = Search(in[(length - 6)], out[2]);
out[4] = Search(in[(length - 5)], out[5]);
}
return out;
}
public String ItoS(int[] in)
{
int length = in.length;
String out = null;
for (int i = 0; i < length; i++) {
if (out == null) {
out = String.valueOf(in);
} else {
out = out + String.valueOf(in);
}
}
return out;
}
public int[] StoI(String in)
{
int length = in.length();
int[] out = new int[length];
for (int j = 0; j < length; j++)
{
String sub = in.substring(j, j + 1);
out[j] = Integer.parseInt(sub);
}
return out;
}
public void TestLength()
{
int[][] pp = getSTable();
for (int i = 0; i < pp.length; i++)
{
int[] x = pp;
for (int j = 0; j < x.length; j++) {
System.out.print(Search(i, j));
}
System.out.println();
}
}
public String getCoded()
{
int length = this.b.length();
int[] ia = StoI(getA());
int[] ib = StoI(getB());
int[] ic = StoI(getC());
int[] id = new int[length];
int[] ie = new int[getA().length() + 1];
int[] ie1 = new int[getA().length() + 1];
int sum_d = 0;
for (int i = 0; i < ib.length; i++) {
id = Search(ib, ic);
}
ie[0] = ia[0];
ie[1] = (ia[0] + ia[1]);
ie[2] = (ia[1] + ia[2]);
ie[3] = ia[2];
if (ie[1] >= 10) {
ie[1] -= 10;
}
if (ie[2] >= 10) {
ie[2] -= 10;
}
ie1 = CrossSearch(ie);
for (int i = 0; i < id.length; i++) {
sum_d += id;
}
int flag = sum_d % 2;
if (flag == 0)
{
int[] f = { ie1[0], id[0], ie1[2], id[2], ie1[1], id[4], id[5], ie1[3], id[1], id[3] };
return ItoS(f) + "F";
}
if (flag == 1)
{
int[] f = { ie1[2], id[3], id[1], id[2], ie1[0], id[5], ie1[1], id[0], ie1[3], id[4] };
return ItoS(f) + "F";
}
return null;
}
public int[][] getSTable()
{
return this.sTable;
}