Here you will get program to convert binary to decimal in Java. We can convert a binary number into decimal in two ways, using Integer.parseInt() method and by using your own logic. Below I have shared program for both the methods. Also Read: Convert Decimal to Binary in Java Convert Binary to Decimal in Java Method …
Here you will get program for armstrong number in java. A number which is equal to the sum of its digits raised to the power n is called armstrong number. Here n is the total digits in the given number. Example: 9 is an armstrong number as n = 1 and 91 = 9. 153 is an …
In this tutorial you will learn about different ways to reverse string in java with examples. For example: Input: Hello World Output: dlroW olleH Ways to Reverse String in Java Method 1: This is the simplest method in which we iterator through given string from end character by character and append to new empty …
Here you will learn about different ways to convert string to character array in java. 1. Using String.toCharArray() Method We can easily convert string to character array using String.toCharArray() method. It can be done in following way.
In this tutorial you will learn about bubble sort in Java. In bubble sort algorithm each element is compared with adjacent element and are swapped if not in correct order. It is one of the simplest but worst sorting algorithm. It is suitable for sorting small list of numbers. As bubbles come up on surface …
Here you will get program for fibonacci series in java using loop and recursion. The series in which next term is calculated by adding previous two terms is called fibonacci series. Example: 0 1 1 2 3 5 8 13 21 34 Program for Fibonacci Series in Java Using Loop
Here you will get java program to reverse a number with while loop and recursion. When we divide a number with 10 then the remainder is the last digit of number and quotient is the number without last digit. / operator is used find quotient and % operator is used to find remainder. We use …
Here you will get java program for leap year. Condition for Leap Year A year completely divisible by 400 is leap year. A year completely divisible by 4 but not divisible by 100 is leap year. For example: 2000, 2008, etc are leap year while 1900, 1997, etc are not leap year. Java Leap Year …