ISBN Number Java5 May 2025 | 3 min read ISBN is another special number in Java. ISBN stands for the International Standard Book Number that is carried by almost each every book. The ISBN is a ten-digit unique number. With the help of the ISBN, we can easily find any book. The ISBN number is a legal number when 1*Digit1 + 2*Digit2 + 3*Digit3 + 4*Digit4 + 5*Digit5 + 6*Digit6 + 7*Digit7 + 8*Digit8 + 9*Digit9 + 10*Digit10 is divisible by 11. The digits are taken from right to left. So, if the ten-digit number is 7426985414, Digit1 and Digit10 will be 4 and 7, respectively. Let's take two numbers and check whether the numbers are legal or not. Example:Number1: 8147852369 Sum = (1*9) + (2*6) + (3*3) + (4*2) + (5*5) + (6*8) + (7*7) + (8*4) + (9*1) + (10*8) Sum = 9 + 12 + 9 + 8 + 25 + 48 + 49 + 32 + 9 + 80 Sum = 281 Now, we divide the sum with 11 and check whether the remainder is 0 or not. If the remainder is 0, the number is a legal ISBN. rem = 281 % 11 rem = 6 != 0 Number 8147852369 is not a legal ISBN because the remainder is not equal to the 0. Number2: 1259060977 Sum = (1*10) + (2*9) + (5*8) + (9*7) + (0*6) + (6*5) + (0*4) + (9*3) + (7*2) + (7*1) Sum = 10 + 18 + 40 + 63 + 0 + 30 + 0 + 27 + 14 + 7 Sum = 209 Now, we divide the sum with 11 and check whether the remainder is 0 or not. rem = 209 % 11 rem = 0 Number 1259060977 is a legal ISBN because the remainder is equal to 0. Steps to implement the ISBN programThese are the following steps that we use to implement the program of ISBN in Java.
Let's implement the code to check whether the number is an ISBN or not by using the above steps: ISBNNumberExample.java Output ![]() |
Array of Doubled Pair Problem in Java
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going to solve...
4 min read
Java program to find the sum of all the nodes of a binary tree
In this program, we need to calculate the sum of nodes present in the binary tree. First, we will traverse through the left sub-tree and calculate the sum of nodes present in the left sub-tree. Similarly, we calculate the sum of nodes present in the...
4 min read
Sphenic Number in Java
In this section, we will learn what is a sphenic number and also create Java programs to check if the given number is sphenic or not. The sphenic number program frequently asked in Java coding tests and academics. Sphenic Number A positive integer n is called a sphenic...
4 min read
Convert Roman to Integer in Java
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going to discuss...
4 min read
Java program to insert a new node at the beginning of the singly linked list
In this program, we will create a singly linked list and add a new node at the beginning of the list. To accomplish this task, we will store head to a temporary node temp. Make newly added node as the new head of the list....
5 min read
Java Program to print the elements of an array in reverse order
Program to print the elements of an array in reverse order Arrays function as essential basic data structures which programmers use frequently for their programs. Java programming uses arrays which store various elements of identical type under a single variable for enhanced data handling efficiency with...
6 min read
Java Program to Display Odd Numbers From 1 to 100
In this section, we will create a Java program to display odd numbers from 1 to 100. To learn the Java odd number program, you must have the basic knowledge of Java for loop and if statement. We can use different Java loops to display odd numbers: Using...
3 min read
Java Program to check whether one string is a rotation of another
Write a code to check whether one string is a rotation of another? File: RotationString .java public class RotationString { public static boolean checkRotation(String st1, String st2) { if (st1.length() != st2.length()) { return false; } String st3 = st1 + st1; if (st3.contains(st2)) return true; else return false; } public static void main(String[] args) { String str1...
1 min read
Java program to print the following spiral pattern on the console
Java Program to Print Spiral Pattern The spiral pattern (or matrix in spiral form) is frequently asked in Java interviews and academics. In this section, we will create a Java program to create a spiral pattern or spiral matrix. What is Spiral Matrix or Spiral Pattern? A spiral...
7 min read
Java Program to Print Odd and Even Numbers from an array
Java Program to print Odd and Even Numbers from an Array We can print odd and even numbers from an array in java by getting remainder of each element and checking if it is divided by 2 or not. If it is divided by 2, it is...
1 min read
We request you to subscribe our newsletter for upcoming updates.

We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India
