rendered paste bodypackage Aufgabe_2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Palindrom {
byte[] buffer = new byte[30];
int length = 0;
String word;
/**
* @param args
*/
public static void main(String[] args) {
Palindrom palindrom = new Palindrom ();
palindrom.lesenZ();
}
public void lesenZ(){
// write introduction to screen
System.out.println("--- Palindrome ---");
System.out.println("Please type in the sequence to check.");
//start reading sequence
try {
length = System.in.read(buffer);
}
catch(IOException exception) {
System.out.println(exception);
}
String word = new String(buffer, 0, length-2);
System.out.println("The sequence to check is: " + word);
}
public boolean pruefenPalindrom(byte buffer[]){
boolean palindromOK = false;
if (length==0){
palindromOK=true;
}
else if(length==1){
palindromOK=true;
}
else if(length > 1) {
String sequence;
if (sequence.charAt(0)==sequence.charAt(length-1){
String Builder;
String Builder1 next;
next.deleteCharAt(int index);
String new Sequence;
}
//int rest = length-(length/2)*2;
//if(rest==0){
//for(int i=0; i<=length/2; i++){
//if(buffer[i] == buffer[length]){
}
//}
// }
// }
return palindromOK;
}
}