Java Program to Convert Binary to Gray Code without Recursion

This is a Java Program to Convert Binary Code of a Number into its Equivalent Gray’s Code Without Using Recursion. Gray code is a binary numeral system where two successive values differ in only one bit. Enter any binary number as an input. After that we perform operations like modulo and divsion to convert it … Read more

advertisement

Java Program to Convert Integer Values into Binary

This is a Java Program to Convert Integer Values into Binary. Enter any decimal number as an input. After that we operatons like modulo and division to convert the gven input into binary number. Here is the source code of the Java Program to Convert Integer Values into Binary. The Java program is successfully compiled … Read more

advertisement

Java Program to Multiply Number by 4 using Bitwise Operators

This is a Java Program to Multiply given Number by 4 using Bitwise Operators. Enter the number you wish to multiply as input. After that we use left shift by 2 to multiply given input by four and hence get the output. Here is the source code of the Java Program to Multiply given Number … Read more

advertisement

Java Program to Find GCD of Two Numbers

GCD stands for Greatest Common Divisor. GCD of two numbers in Java is the largest positive integer that completely divides both the given numbers. Example: GCD(10,15) = 15, GCD(12,15) = 3. Problem Description Write a Java Program to Find the GCD of two numbers. Problem Solution 1. Take two numbers as input. 2. Start a … Read more

advertisement

Interface Program in Java

Interface Program in Java: An interface is a set of rules or blueprints that a class must follow by implementing abstract methods and constants. It helps achieve abstraction and polymorphism, and classes can implement multiple interfaces. Syntax of Interface in Java The syntax for declaring an interface in Java is as follows: public interface InterfaceName … Read more

advertisement

Java Program to Handle the Exception Using Try and Multiple Catch Block

This is a Java program to handle the Exception using Try and Multiple Catch Block. A Java exception is an error condition that has occurred in a piece of code on violation of some rules. Java Exception Handling is managed via five keywords: try, catch, throw, throws, and finally. Here is the source code of … Read more

advertisement

Java Program to Handle the User Defined Exception using Throw Keyword

This is a Java Program to Handle the User Defined Exception Using Throw Keyword.A part from existing Exceptions in java, we can create our own Exceptions (User defined exceptions in java) Here is the source code of the Java Program to Handle the User Defined Exception Using Throw Keyword. The Java program is successfully compiled … Read more

advertisement

Java Program to Create Applet to Simulate Any Sorting Technique

This is a java program to create an applet to simulate a sorting technique. This applet demonstrates Bubble Sort. Here is the source code of the Create Java Applet to Simulate Any Sorting Technique. The Java program is successfully compiled and run on a Windows system. The program output is also shown below. package com.sanfoundry.combinatorial; import … Read more

advertisement

Java Program to Multiply Two Matrices

Matrix multiplication in Java is the process of multiplying two matrices using the dot product of rows and columns, calculated using nested for loops. The resulting matrix has the same number of rows as the first matrix and the same number of columns as the second matrix. Constraint: For Multiplication of two matrices, the columns … Read more

advertisement

Graph Representation using Incidence Matrix in Java

This is a java program to represent graph as a incidence list. The incidence matrix of G is a n × m matrix (b_{ij}), where n and m are the numbers of vertices and edges respectively, such that b_{ij} = 1 if the vertex v_i and edge x_j are incident and 0 otherwise. Here is … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.