Java - Write code to check if a string is Palindrome

Requirements

Write code to check if a string is Palindrome

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String words = "book2s.com";
        System.out.println(isPalindrome(words));
        /*from   w  ww  . j  a  v  a 2s  .c  o  m*/
         words = "level";
        System.out.println(isPalindrome(words));
    }

    public static boolean isPalindrome(String words) {
        // Remove spaces since they don't count
        String cleanedWords = "";
        for (int i = 0; i < words.length(); i++) {
            char currentChar = words.charAt(i);
            if (currentChar != ' ')
                cleanedWords += currentChar;
        }

        // Check that string is same reversed as normal
        // (First half of string should be the same as second half)
        for (int i = 0; i < Math.floor(cleanedWords.length() / 2); i++) {
            if (cleanedWords.charAt(i) != cleanedWords.charAt(cleanedWords
                    .length() - i - 1))
                return false;
        }

        return true;
    }
}