I do have some piece of code, I find unfathomable to comprehend. I save a longer string in a variable and then try to find a specific piece of string inside of it. The clue is that I can output the various substrings, but it will not find the specific string and stop the process...
The code goes like this:
import java.io.*;
import java.util.*;
public class Readin {
public static void main(String[] args) {
String specChar = "DISD";
String gen = "MLRVFILYAENVHTPDTDISDAYCSAVFAGVKKRTKVIKNSVNP";
for (int i = 0; i < gen.length() - 3; i++) {
char char1 = gen.charAt(i);
char char2 = gen.charAt(i + 1);
char char3 = gen.charAt(i + 2);
char char4 = gen.charAt(i + 3);
String concatChar = new StringBuilder().append(char1).append(char2).append(char3).append(char4).toString();
System.out.println(concatChar);
if (specChar == concatChar) {
System.out.println(specChar);
break;
} else {
System.out.println("Error");
}
}
}
}