Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {
        String str2 = "noon";
        System.out.println(isPalindrome(str2));
    }

    public static boolean isPalindrome(String inputString) {
        int len = inputString.length();
        if (len <= 1) {
            return true;
        }
        String newStr = inputString.toUpperCase();
        boolean result = true;
        int counter = len / 2;
        for (int i = 0; i < counter; i++) {
            if (newStr.charAt(i) != newStr.charAt(len - 1 - i)) {
                result = false;
                break;
            }
        }
        return result;
    }
}