Answers for "isPalindrome in java"

0

ispalindrome function java

import java.util.Scanner;

public class iSPALINDROME {

        public static void main(String[] argh){
            System.out.print("Enter some integer: ");
            Scanner input = new Scanner(System.in);
            String n = input.next();
            Ispalindrome(n);
            input.close();

        }
        public static boolean Ispalindrome(String s) {
            int length = s.length();
            int i = 0;
            int midle = (s.length() / 2);
            boolean ispalindrome = true;
            int k = length-1;
            for (int j = 0; j <= midle& k>=midle; ++j,--k) {
                if(j==0 & s.charAt(j)=='-'){
                    ++j;
                }
                if (s.charAt(j) == s.charAt(k)){
                    ispalindrome = true;

                }else{ispalindrome = false;break;}
            }return print(ispalindrome);
        }

        public static boolean print(boolean ispalindrome){
            System.out.println(ispalindrome);
            return true;
        }



}
Posted by: Guest on July-14-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language