string palindrome in java using array

Solutions on MaxInterview for string palindrome in java using array by the best coders in the world

showing results for - "string palindrome in java using array"
Michela
03 Aug 2019
1public static boolean checkPalindrome(String str)
2{     
3 
4    int len = str.length();
5
6    for(int i = 0; i < len / 2; i++)  {
7        if (str.charAt(i) != str.charAt(len - i - 1))
8            return false;
9    }
10    return true;
11}
Lena
21 May 2016
1import java.util.*;   
2class PalindromeExample2  
3{  
4   public static void main(String args[])  
5   {  
6      String original, reverse = ""; // Objects of String class  
7      Scanner in = new Scanner(System.in);   
8      System.out.println("Enter a string/number to check if it is a palindrome");  
9      original = in.nextLine();   
10      int length = original.length();   
11      for ( int i = length - 1; i >= 0; i-- )  
12         reverse = reverse + original.charAt(i);  
13      if (original.equals(reverse))  
14         System.out.println("Entered string/number is a palindrome.");  
15      else  
16         System.out.println("Entered string/number isn't a palindrome.");   
17   }  
18}  
Sofia
22 Jul 2018
1import java.util.Scanner;
2
3public class Palindrome
4{
5  public static void main(String args[])
6  {
7    int num,temp,reverse=0;
8    Scanner input=new Scanner(System.in);
9    num=in.nextInt();
10    temp=num;
11    //code to reverse the number
12    while(temp!=0)
13    {
14      int d=temp%10; //extracts digit at the end
15      reverse=reverse*10+d;
16      temp/=10; //removes the digit at the end
17    }
18    // 'reverse' has the reverse version of the actual input, so we check
19    if(reverse==num)
20    {
21      System.out.println("Number is palindrome");
22    }
23    else
24    {
25      System.out.println("Number is not palindrome");
26    }
27  }
28}
Ilyana
30 Nov 2019
1package test
2//The function below checks if a string is a palindrome
3//True = Is a palindrome & False = Not a palindrome
4	public boolean isPalindromString(String text){
5    	String reverse = reverse(text);
6      	if(text.equals(reverse))
7    	{
8        	return true;
9      	}
10      
11      	return false;
12    }
13//This function returns the reverse String of its input.
14//Ex. if given "hello", it will return "olleh"
15	public String reverse(String input)
16    {     
17		if(input == null || input.isEmpty())
18        {
19			return input;
20        }
21        	return input.charAt(input.length()- 1) + reverse(input.substring(0, input.length() - 1));
22    }
Greta
28 Nov 2020
1package test
2//The function below checks if a string is a palindrome
3//True = Is a palindrome & False = Not a palindrome
4	public boolean isPalindromString(String text){
5    	String reverse = reverse(text);
6      	if(text.equals(reverse))
7    	{
8        	return true;
9      	}
10      
11      	return false;
12    }
13//This function returns the reverse String of its input.
14//Ex. if given "hello", it will return "olleh"
15	public String reverse(String input)
16    {     
17		if(input == null || input.isEmpty())
18        {
19			return input;
20        }
21return input.charAt(input.length()- 1) + reverse
22                         (input.substring(0, input.length() - 1));
23    }
Marta
29 Jul 2019
1// String palindrome in java using array
2import java.util.Arrays;
3import java.util.Scanner;
4public class StringPalindromeUsingArray 
5{
6   public static void main(String[] args) 
7   {
8      System.out.println("Please enter string to check whether string is palindrome: ");
9      Scanner sc = new Scanner(System.in);
10      String strInput = sc.nextLine();
11      char[] chArray = strInput.toCharArray();
12      int size = chArray.length;
13      char[] chGiven = Arrays.copyOf(chArray, chArray.length);
14      for(int a = 0; a < size / 2; a++) 
15      {
16         char temp = chArray[a];
17         chArray[a] = chArray[size - a - 1];
18         chArray[size - a - 1] = temp;
19      }
20      System.out.println("Given array: " + Arrays.toString(chGiven));
21      System.out.println("String palindrome using array: " + Arrays.toString(chArray));
22      if(Arrays.equals(chArray, chGiven)) 
23      {
24         System.out.println("string is palindrome.");
25      }
26      else 
27      {
28         System.out.println("string is not a palindrome.");
29      }
30      sc.close();
31   }
32}
queries leading to this page
check if a string is palindrome in javafind out prime palindrome numbers javawrite a java program to find whether entered number is palindrome or notpalindrome number program javapalindrome java stacklongest palindrome in a string javapalindrome code substring javapalindrome or not javapalindrome in java 8polyndrom java code with scannerprogram to check whether the number is palindrome or not in javajava swing program to check string is palindrome or notpalindrome number program in javasimplifystring palindrome javapalindrome subarray in javahow to find the palindrome number in javapalindrome range in javapalindrome using for loop in javapalindrome program using while in javacheck for palindrome for integer in javahow to find anti palindrome in javawhat is palindrome string in javaprogram to check palindrome word om javajava for palindromepalindrome number in java using stackpalindrome math java java number is palindromepalindromecutting 28s 29 in javawrite a java program to find whether a string or number is palindrome or not number palindrone or not javapalindrome of string in javapalindrome string in java usingn arraysprogram in java to check string is palindromejava program for pallindromepalindrome string in java with a fixed lengthwrite a program to check whether a given string is palindrome or not javajava palindrome number programcheck if number is a palindrome javato print all palindrome number in javahow to check for a palindrome in javafind the palindrome of size k and length n in javajava program to print all palindrome words in a stringpalindrome string java codepalidrome javahow to check string is palindrome or not in javajava program to check if string is palindromechecking string palindrome in javawrite a complete java program that will determine if a given number is a palindrome palindrome string in java codehow find the palindrome of the string recursive in javahow to check the palindrome number in html using javafxcheck number is palindrome or not in javacheck if string is a palindrome javacheck if string is palindrome javagiven string is palindrome number or not in javapalindromic dates program javaandroid check if a string is a palindrom numberis palindrome java in builtpalindromes javajava code for finding a palindrome numberpalindrome number meaningwrite a java program to check whether the given number is palindrome or notpalindrome function in javpalindrome function in javahow to check panlindrome in javastring array palindrome java with explanationstring palindrome in java using functionprogram to find palindrome numbers between given range in javacheck for palindrome in javapalindrome in java for a wordstring palindrome javafunzione palindroma javajava palindromepalindrome using java 8palimdeome metod in javapalindromic checking in javaprogram to print palinf 5cdrome in javanumber palindromehow to see if a string is palindrome or not in java programprogram to check palprime in javacheck no is palindrome or not in javapalindrome stinf javapalindeom code in javathe palindrome game java solutionpelindrom logic javapalindrome method palindrome in java intpalindrome java optimizejava program to find whether the given number is palindrome or notpalindrome number in java from 1 to 100 check the given name is palindrome or not in javais palindrome java while loopprograam to check palindrome java java program for palindromefind the palindrome in a string javapalindrome string with remainder javawrite a java program to find if the given number is palindrome or notpalindrome number in java geeksforgeekssentence palindrome javapalindrome for phrase in javajava collections pallindromeimplement a palindrom checker in javacheck palindrome string in javajava rmi palindrome programhow to check palindrome number in java gfgwrite a program that prints if the given input string is a palindrome or not java code for palindromepalindrom program in javahow to check if number is palindrome in javawhat is palindrome numberhow to check whether a word is palindrome or not in java without using string functionis palindrome java palindrome program in javacreate palindrome from a string javabest code for checking if a string is palindromejava program for palindrome numbereasy palindrome program in javapalindrome simple program in javajava program to check given number is pallindrome or notpalindrome no in javapalindrome checker java with string functionsalindrom in javahow to check palindrome nuber javaalogorithm in java to check whether a string is palindrome or notwhat is a palindrome number in javapalindrome alphabet program in javawrite a simple palindrome program in javapalindrone check string javapalindrome numbers between the given range of numbers in javajava program for palindrome stringwrite java program to check if a number is palindrome in java 3fnumber is palindrome or not javatest cases for palindrome number javafind palindrome string in javapalindrome gfg javahow to find the largest palindrome in javapalindromeclass javapalindrome number in java from 1 to 1000to check if a string is palindrome in javahow to print palindrome javastring palindrome in java using reverse methodpalindrome numberdetecting palindromes in javapalindrome string java programpalindrome java codejava program forpalindromejava code palindrome stringhow to traverse a palindrome java using substring methodpalindrome code in javapalingrome in javanumber is palindrome javajava number palindromestring is palindrome on not in javahot to code if a number is palindrome in java string is palindrome in javafastest way to check a number is palindrome in javahow to check if a string contains a palindrome in javacheck whether string is palindrome or not in javahow to palindrome in javapalindrome for string javafind palindrome number in javado palindrome string in javahow to find next palindrome number in javahow to initialize n for palindrome in javajava program to read user input of a palindromejava program for palindrome or notjava program to find whether the number is palindrome or notstring palindrome program in java palindrome javapalindrome number in javapslindrome in javapalindrome in javahow to check if string is a palindrome in javajava palindrom easyjava program to check palindromepalindrom program using javamake a palindrome in netbeanscheck if a sentence is palindrome javachecking a palindrome in javapalindrome java palindrome words javajava program makes palindromepalindromo java codigopalindrome number javastring palindrome program in java using for loopjava palindromes for spaces 2fwrite a java program which read no from the user and check if this no is a palindrome or notpalindrome string javacheck the word ism palindrome javapalindrome number in java 3a write a program to enter a number and check whether it is palindrome number or not program to check palindrome in javastring in java palindrome string palindrome in java using arrayhow to find a palindrome number in javapalindrome character wrapper class in java examplecheck number palindrome javamatch two string for palindrome in javaa palindrome is a number that reads the same java solutionpallindrome java codedetermine if a string is a palindrome javaint palindrome in javapalindrome function with numbers in javapalindrome in given range javacheck integer palindrome javastring is palindrome in javaprogram to check palindrome javajava program for palindrome number 10thpalindrome of number in java programpalindrome no logic in javanumber palindrome javajava find palindrome in stringpalindrome check javapalindrome number checking methods in javapalindrome integer javapalindrome between range javafinding palindrome in a string javapalindrome java program stringjava program to check whether a number is palindrome or notchange one character to get palindrome in javafind all possible palindromes in a string in javapalindromic string in array javapalindrome or not in javajava palindrome functionpalindrome test javahow to find next palindrome stringin javapalindrome program javajava program to check palindrome string using collectionhow to create a number palindrome in javaa java palindrome programjava check plaindromestring palindrome code in javahow to solve palindrome problem in java with 5 test casespalindrome word in javachecking for palindrome array in javais palidrome in javapalindrome program in java whether string or numberpalindrome no in java gfgcheck palindrome of a number in javawrite a program to accept a number from the user through command line and display whether the given number is palindrome or not palindromic pattern in javapallindorme javapalindrome method in java stringpalindrome string using arrats javapalindrome number java programpalindrome string in javacheck if a number is palindrome in javawrite a java program to check if an input number is a palindrome or not palindrome number in diamond in javacreate palindrome of size n in javais palindrome java testhow to check palindrome number in javahow to find a string is palindrome or not in javajava check if input is palindromeprint palindrome or not in javadetect palindrome in javapalindrome number check in javalongest palindrome program in javafunction to check palindrome in javajava palindrome with loopjava coding palindromejava integer palindromecheck palindrome javawrite a java program to find whether a string is palindrome or notstring palindrome in java using for looppalindrome of number in javachecking if a number is a palindrome javacheck number is palindrome in javapalindrome number in java using booleanpalindrome string in java programcode for palindrome string in javapalindrome using string in javapalindrome logic in java palindrome in java programlargest palindrome in string javapalindromic numbers in jvawrite a program to check whether a given string is palindrome or not in javapalindrome numnber in javahow to do palindrome javalongest palindrome in a string in javahow to create a palindrome in java with an array og charpalindrome of a string in javapalindrome string complex java program using user inpuadd palindrome math javaword is palindrome in javastring palindrome using stack in javahow to get palindrome of a int in javapallindrome number in javawrite a java program that checks whether a given string is a palindrome or not java program makes palindrome numberbeeter algorithme to check palindrome javahow to check palindrome of number using library function in javapalindrome string javajava palindrome solution charathow to check if a number is palindrome javahow to check palindrome in java palindrome in javacheck if number is palindrome javacheck no is a palindrome or not in java string palindrome in javasubstring palindrom javacode to return a palindrome string in javainteger palindrome check in javahow to check the palindrome number in html using javaplaindrome javais palindrome program in javacheck number palindrome program javawrite a simple java program to check if a given string is palindrome or not string is palindrome or not in javapallindrome in javahow to generate palindrome numbers in javapalindrom using menthod javagiven a line print only those words which are palindrome in javacode for string palindrome in javapalindrome in java stringcheck a string is palindrome or not in javapallindrome program in javawhat is palindrome in javarange of palindrome in javachcek whether a number is a palindrome or not in javapalindrome javapalindrome app in javapalindrome program in java using stringbuilderwrite a java program to accept a number and check if it is a palindrome what is palindrome number in javauser input palindrome in javajava program to find plaindromepalindrome in java using stackpalindrome java inthow to check if something is a palindrome in javapalindromic numbers range in javajava check if string is palindromehow to check that wheater the word is pallindrome using javacheck a string is palindrome in javawrite a function in java pallindromejava string palindrome or notpalindrome series in javawrite a program in java to find the number is palindrome or notinteger palindrome program in javacheck palindrome java char arrayjava palindrome program for stringpalindrome test class java 60check palindrome in java in range for nubmerpalindrome examples in javajava palindrome programjava palindromespalindrome integer in javahow to check if int is palindrome javabest algorithm plaindrome javafind palindrome in string javagiven a string 2c write a java function to check if it is palindrome or notpalindrome phrases javapalindrome in java rangelalindrome in javapalindrome ll in javapalindrome numbers in javapalindrome method in string class in javacheck if array is palindrome javawrite a function in java pallindrome stringjava code for palindrome stringjava palindrome reverse stringpalindrome program in java 5cfind whether the given number is palindrome or not number is palidrome in java examplebreak the palindrome in javahow to check if a number is a palindrome in javapalindrome solution javapalindrome using stack in javathe java code given below should find whether the number is a palindrome or not palidrome in javalogest palindrome in javapalindromic prime number javahow to check if palindrome javajava palindrome stringjava palindrom explainedwrite a java program for palindrome numberhow to find palindrome javapalindrome checker in javafind given integer palindrom or not javajava check palindromehow do you check if a given string is a palindrome in java 3fwrite a java program that checks whether a given string is a palindrome or not in javafonction palindrome en javapalindrome java checkwrite a java program palindrome or notwrite a programme to check pallindrome of num javacheck palindrome in javajava palyndromepalindrome in jvausing a boolean method to find a palindrome javapalindrome number in jaapalindrom java integerpalindrome path in javawrite a program to check whether a string is palindrome or not in javajava ispalindromeprogram related to palindrome in javajava palindrome numbers within a rangejava program to check the string is palindrome or notpalindrome questions javajava print a palindromepalindromecheck in javapalindrome java programestring array palindrome javato check whether number is palandrome or not in javapalindrome string using arrays javafunction to check string is palindome in javaalgorithm for string palindrome in javapalindrome in java geeksforgeekscheck if a string is palindrome javahow to traverse a palindrome java using a string methodhow to code a palindrome in javafunction to check given string string is palindrome or not in javapalidrim string in javacode for palindrome in javawrite a java program to determine whether a given word is a palindrome or not how to check if a string is a palindrome in javapalindroom javajava palindrome numbernumerical diamond palindrome program in javapalindromenumber program in javapalindrome no program in javajava program to find whether a number is palindrome or notpalindrome or not in java programhow to check if a string will be a palindrome in javapalindrome java programjava palindrome using integerhow to make a palindrome checker in javapalindromic in array javapalindrom a string in javapalindrome numbers javastring reverse palindrome in javaispalindrome for a number in javacheck if string of size n is palindrome javais palindrome string javahighest value palindrome in javachecking a palindrome string in javacommand line program to check if a number is palindrome or not in javaarray palindrome javapalindromenumber in javahow to find palindrome number in javapalindrome string ajvajava string palindromepalindrome method java palindrome finder function javawrite a jaba program to check if a string is pallindormejava get total palindrome in stringno of palindrome numbers in range in javawrite a palindrome program in javacheck if palindrome javapalindrom number in javapalindrome jacanumber is a palindrome javaadvanced palindrome string question in jvawrite a program to check whether a string is palindrome or not javajava palindrome algorithmnumber is a palindrome or not javajava palindrome methodpalindrome words java programcreating a palindrome in javastring palindrome in javapalindrome date program in javacheck a string is a palindrome or not in javahow to check palindrome array in javahow do you check if a given string is palindrome or not 3f by java 8sub palindrome in javapossible palindrome in javajava determine if a string is palindromewrite a funnciton its take a string and return palindrom number in javapalindromic numbers in javapalindrome string with javanumber palindrome program in javahow to check a word for palindrome in javacheck string palindrome in javajava palindrime checker codemake a palindrom out of 4 number javapaindrome of numbers javapalindrome in javaapalindrome lab javamake palindrome javause stack to check palindrome javatest if string is palindrome in javalongest palindrome in string javapalindrome program in java using for looppalindrome with javastring palindrome in java 8palindrome java codingfacearray of words palindrome javais it a palindrome in javareverse string java palindromeplaindrome with reverse java example wirh scannerjava palindromicjava program to check whether string is palindromeis palindrome method in javajava check palindrome numberjava diff way to do pallidromeanti palindrome string in javacheck palindrome number in javapalindrome using stack javaexplanation of solving palindrome javapalindrome or not javacheck string is palindrome or not in javachecking if integer is palindrome javapalindrom in java programmierenmake a palindrome in javaint palindrome in java using for looppalindrome number in java geeksforgeeks 5ccheck if int is palindrome javacheck palindrome methodsjava palindrome number checkercheck whether a number is palindrome or not in javafind all palindrome numbers between two numbers in javaispalindrome java codepalindrome formula in javahow to check palindrome string in javapalindromic string in javahow to count palindrome in javafind if given string is palindrome in javapalindrome program in javapalindrom permutation javapalindrome method in code in javapalindrome in java using for loopjava program to find the palindrome numbers in an arrayfind all palindromes in a string javaphrase palindrome in javapallindrome javawrite a function to find out longest palindrome in a given string in javapalindrome dll javapalindrome number using array in javajava program to check whether string is palindrome using library methodspalindrome number in java using string methodspalindrome for string in javainteger palindrome in javaalgorithm for palindrome number in javapalindrome check in javapalindrome java questionnumber palindrome in javapalindrome algorithm javajava ispalindrome codecheck for palindrome javapalindrom in javaimplement a program to check whether a given number is a palindrome javajava palindrome interface examplejava program to check palindrome string in a efficient wayhow to print a palindrome in javaa number is palindrome or not in javajava palindrom easy arrayhow to code palindrome in javawrite a program to check whether the given string is palindrome or not in javapalindromes using javapalindrome checker javapalindrom check javamake palindrom javadefine palindrome in javapalindrome in java using stringhow to get palindrome of a number in javaprint palindrome in javajava code for palindromjava program to check number is palindrome or notfind method in array of palindrome in javapalindrome number ina range javapalindrome number or not in javahow to palindrome a int in javajava palindrome given a string s is palindrome or notjava polindrome interfacepalindrome in java using booleanpalindrome number using stack in javahow to do palindrome in javajava check if numbers are palindromecheck for palindrome algorithm javais palindrome possible program in java wiprojava check if palindromejava program to find palindrome numberhow to check if a string is palindrome in javapalindromes from 1 to n in javahow to check if a number is palindrome in javapaliindrime in javanumber is palidrome or nit in javapalindrome check from reverse 28 29 in javapalindrome java questions java program to find palindromepalindrome in java for a stringhow to find palindrom in javachecking if an integer is a palindrome javajava program palindromepalindrome java programspalindrome function javawap palindrome in javarearrange numbers to form palindrome if possible in javajava check palindrome stringpalindrome method in javajava palindrome checkerstring plandrom example in javalongest palindrome in javapalindrome of a number in javafunction palindrom javapalindrome string in java using stacknumber is palindrome or not in javapalindrome in a string javapalindrome sort javapalindromic score javaa palindrome javapalindrome javajcheck whether a string array is palindrome or not in javapalindrome in java time complexityjava multithreading program to find palindromepalindrome string program in javapalindrome numbers in given range in javahow to check if a string is palindrome javapalindrome using predicate in java 8java string palindrome programchecking for palindrome in javapalindrome code javaif number is palindrome javapalindrom java wap in java to check whether a string is palindrome or not write a program to check whether a number is palindrome or not in javacalculate palindrome numbers in a range in javaplaindrome a string in javajava polindromewhat is palindrome javaall substrings palindrome javapalindrome ajvahow to find a palindrom in ajava stringjava program to check palindromicity of a programpalindrome for integer in javacheck if a number is palindrome javacheck palindrome using stack in javahow to check given number is palindrome or not in javawap to check whether a number is palindrome or not javapalindromes examples java examplehow to traverse a palindrome javahow to find whether a string is palindrome or not javaprogram to find palindrome string in javak palindrome program in javapalindrome in javaidentify palindrome in javacheck if string is palindrom javafinding palindromes javacheck palindrome program javahow to find a palindrome in javapalindromos en java how to find palindrome in javaalgorithm for palindrome in javapalindrome a string in javajava program to check whether a number is palindrome or not using functionpalindrome number in java using while looppolyndrome in javapalindrome string algorithm javapalindrome array in javapalindrome string in java geeksforgeekspalindrome prime number in javajava is palindrome methodlongest possible palindrome in javapalindrome printing in javacheck whether a word is palindrome or not in javafind given number palindrom or not javajava palindrome codehow to check if the string is palindrome javamake a string palindrome in javajava program find integer as palindromejava code for integer palindromewrite a function f that determine string is palindrome javajava program to0 find palindrome numbersstring palindrome in java codejava program of palindromechecking palindrome string in javajava to detect a palindromecheck word is palindrome program in javapalindrome number in java using methodspalindrome words in javagenerate palindrome javacheck the string is palindrome or not in javapalindrome number using for loop in javapalindrom in a matrix javaprint first n palindrome numbers in javaispalindrome javahow to write palindrome string java codemake palindrome method in javacheck palindrom code fight javachecking palindrome in javajava program to check if a number is palindrome or notpalindrome noin javaallintitle 3astring palindrome in java using arrayhowto check if a string is a palindrome in javafind count of palindromes in a string in javapalindrome java numberis palindrome function in javapalindrome substring in javacreate palindrome javapossible palindrome integer in javapalindrome in string javais string a palindrome javareverse palindrome program in javaprogram to check palindrome number in javapalindrome of number add them together javais palindrome in javahow to compare palindrome in javacreate function palindrome number in javapalindrome number code in javahow to check if a word is palindrome in javahow to create a palindrome in javastring special palindrome in java 8palindrome number checker javapalindrome of integer in javahow to make user defined function for palindrome in javahow to make a palindrome java10 write a palindrome program in javaperfect palindrome javapalindrom programmieren javahow to palindrone in javapal c3 adndromo java polyndrom java codealmost palindrome javapalindromic string in array java with exaplanationpalindrom number in javaflowchart to check if a number is palindrome or not in javastring palindrome in java using array