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();
pruefenPalindrom(word);
}
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(String word){
boolean palindromOK = false;
if (length==0){
palindromOK=true;
}
else if(length==1){
palindromOK=true;
}
else
if(length > 1){
int rest = length%2;
if(rest==0){
int max = length/2;
if(buffer[i] == buffer[length]){
}
}
else{
int max = (length-1)/2;
if(buffer[i] == buffer[length]){
}
}
}
}
return palindromOK;
}