Commit 4176483b authored by jackt's avatar jackt

save

parent 9a87b765
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="maths"/>
<classpathentry excluding="src/|maths/" kind="src" path=""/>
......
......@@ -30,11 +30,11 @@ public class Program {
String character = "";
int total = 0;
int b = binary.length() -1;
int c = l-1;
resultsArray[c] = total;
int c = l;
int d = resultsArray[0];
int e = resultsArray[1];
int f = resultsArray[2];
int g = resultsArray[3];
for (int a = 0; a <= b; a++) {
......@@ -46,11 +46,12 @@ public class Program {
char theChar = binary.charAt(a);
character = Character.toString(theChar);
if (a == 0 && character.equals("1")) {
if (a == 0 && character.equals("1"))
{
total = total++;
continue;
}
else if (character.equals("0") && a == 0)
if (character.equals("0") && a==0)
{
continue;
}
......@@ -59,47 +60,55 @@ public class Program {
case 1:
if (character.equals("1")) {
total = total + 2;
resultsArray[l] = total;
continue;
}
case 2:
if (character.equals("1")) {
total = total + 4;
resultsArray[l] = total;
continue;
} else
continue;
case 3:
if (character.equals("1")) {
total = total + 8;
resultsArray[l] = total;
continue;
} else
continue;
case 4:
if (character.equals("1")) {
total = total + 16;
resultsArray[l] = total;
continue;
} else
continue;
case 5:
if (character.equals("1")) {
total = total + 32;
resultsArray[l] = total;
continue;
} else
continue;
case 6:
if (character.equals("1")) {
total = total + 64;
resultsArray[l] = total;
continue;
} else
continue;
case 7:
if (character.equals("1")) {
total = total + 128;
resultsArray[l] = total;
continue;
} else
break;
case 8:
if (character.equals("1")) {
total = total + 256;
resultsArray[l] = total;
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment