Author Archive


How To Subtract Two Matrices in Java

Matrix operations are important in a number of programming problems in the areas of image processing, probability theory and physics simulation. Matrix subtraction is simple, and it involves subtracting each entry in the second matrix from the corresponding entry in the first matrix. The following Java program demonstrates matrix subtraction. This example uses constant matrices […]

How to Add Two Matrices in Java

Matrix operations are important in a number of algorithms. It is used in graph theory, geometry, probability theory and image processing. Matrix addition is simple, each entry in first matrix is added to the corresponding entry in the second matrix to get the entry in the result matrix. The following sample program illustrates matrix addition […]

How to Run External Program in Java

From your Java program, it is possible to run other applications in your operating system. This enables you to make use of system programs and command line utilities from your Java program. Here are some typical uses of this feature when running your Java program in Windows, You want to invoke a Windows program such […]

How to Check Whether a Year is Leap Year in Java

Usually there are 365 days in a year. However once every four years, there are 366 days in year. This year is called leap year and on a leap year, February has 29 days. However not all years divisible by 4 are leap years. Following are the rules to determine whether a year is leap […]

How To Reverse a String in Java

There are a multiple ways to solve a programming problem. There may be library classes that may be very useful in solving programming problems. If you don’t know these classes and methods, you will end up  spending time writing your own methods and wasting time. We would use the programming problem of reversing a given […]