Let’s learn java program to insert an element at specific position in an array. Java program to insert an element at specific position in an array To insert an element at specific position in an array first user enters size of the array using nextInt() method of Scanner class and then enters all elements of…

Read More Java program to insert an element at specific position in an array

Let’s learn remove element from a specific index from an array in java. Remove element from a specific index from an array in java Now let’s learn to remove element from array by index. So to remove an element by index from an array first we have to find element at specified index and remove…

Read More Remove element from a specific index from an array in java

Let’s learn java program convert decimal to octal using while loop. Java program convert decimal to octal using while loop Let’s learn to convert decimal number to octal using while loop. import java.util.Scanner; public class DecimalToOctalUsingWhileLoop { public static void main(String[] args) { int decimal; Scanner sc = new Scanner(System.in); System.out.println(“Please enter decimal number: “);…

Read More Java program convert decimal to octal using while loop

Let’s learn java program to convert decimal to hexadecimal using recursion. Java program to convert decimal to hexadecimal using recursion Here’s the program to convert decimal to hexadecimal using recursion. import java.util.Scanner; class DecimalToHexaDemo { char[] charHexa ={‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’A’,’B’,’C’,’D’,’E’,’F’}; int num; String strHex = “”; String hexadecimal(int h) { if(h != 0) { num = h…

Read More Java program to convert decimal to hexadecimal using recursion

Let’s learn decimal number to binary in java using recursion. Decimal number to binary in java using recursion Here’s the program to convert decimal to binary using recursion. The logic to convert decimal to binary using recursion is, if(decimal == 0) return 0;else return(decimal % 2 + 10 * toBinary(decimal / 2)); public class DecimalToBinaryUsingRecursion…

Read More Decimal number to binary in java using recursion

Let’s learn convert decimal number to binary in java without using array. Convert decimal number to binary in java without using array To convert decimal number to binary without using array we are using StringBuilder class. Here’s the java program to convert decimal to binary without using array. public class DecimalToBinaryWithoutArray { static void toBinary(int…

Read More Convert decimal number to binary in java without using array

Let’s learn multiply two numbers without using arithmetic operators in java. Multiply two numbers without using arithmetic operators in java Let’s learn how to multiply two numbers without using arithmetic operators using for loop. import java.util.Scanner; public class MultiplyWithoutArithmeticOperators { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number1, number2, multiply…

Read More Multiply two numbers without using arithmetic operators in java

Let’s learn subtract two numbers without using arithmetic operators in java. subtract two numbers without using arithmetic operators in java We can subtract two numbers without using arithmetic operators. To do that we have written static int function subtractNumber() to subtract two numbers which return subtraction of two numbers. To subtract two numbers without using…

Read More subtract two numbers without using arithmetic operators in java

Let’s learn addition of two numbers in java using class and objects. Addition of two numbers in java using class and objects Let’s learn to print addition of two numbers in java using classes and objects. Here’s the java program to add two numbers in java using class and objects or sum of two numbers…

Read More Addition of two numbers in java using class and objects