Found 2616 Articles for Java

Replace the Matrix Elements by Its Square in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 12:07:03

581 Views

Matrices are nothing but it’s more than a collection of data elements arranged in a rectangular layout that is two-dimensional. In Java, an array with two dimensions can be considered as a matrix. As per the problem statement the task is replace the matrix elements by its square. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original matrix is {{8, 3, 2}, {12, 7, 9}, {6, 4, 10}}; After replacing the matrix element by its square, the result matrix will be 64 ... Read More

How to Homogenize a Point in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 11:59:15

131 Views

In this article we will see how to homogenize a point. Any point in the projective plane is represented by a triple (X, Y, Z), called homogeneous coordinates or projective coordinates of the point, where X, Y and Z are not all 0. The point represented by a given set of homogeneous coordinates is unchanged if the coordinates are multiplied by a common factor. As per the problem statement we have to homogenize a point by taking any common factor and multiplying it with the given points. Let’s start! To show you some instances Instance-1 Suppose the points are (10, ... Read More

How to Get File Owner’s Name in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 12:02:15

759 Views

As per the problem statement, we are going to find the file owner name in Java. The owner’s name here represents the owner of the PC in which file is being runned. To find the file owner in Java we will use the getOwner() method of the FileOwnerAttributeView class. FileOwnerAttributeView belongs to the java.nio class. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the given file location is “D:/saket.txt”. After checking for Owner name of the given file, the output will be − ... Read More

How to Get a List of Current Open Processes Java?

Mr. Satyabrata
Updated on 04-Apr-2023 12:14:06

1K+ Views

It is essential for the user to know about the processes that are running in their system, be it foreground or background. To do so in windows we have a task manager but internally it uses a program called tasklist. Tasklist aside from giving us the currently running processes, it also gives us details like process id, session name, session and memory usage of each process. In this article we will see how we can get a list of currently open processes by using Java programming language. Algorithm Step 1 − Create a process that executes the tasklist.exe Step 2 ... Read More

How to Find Single Digit Array Elements in Java?

Mr. Satyabrata
Updated on 09-Mar-2023 11:21:50

2K+ Views

In a given array with some random integer values, we have to find out the single digits available in the given array and print those single digit values as output. An array can contain positive or negative numbers irrespective of the number of digits in a number. As here all elements belong to numeric type. Note- Take a positive integer array. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Given Array= [1, 12, 3, 4, 10, 15]. The single digit elements present in the ... Read More

Find Number of Sorted Rows in a Matrix in Java?

Mr. Satyabrata
Updated on 06-Mar-2023 17:26:21

286 Views

Matrices are nothing but a collection of data elements arranged in a rectangular layout that is two-dimensional. In Java, an array with two dimensions can be considered as a matrix. As per the problem statement the task is to count all the rows in a matrix that are sorted either in strictly increasing order or in strictly decreasing order. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original matrix is{ { 5, 6, 7, 8 , ... Read More

Find Minimum Elements in Each Row of Matrix in Java?

Mr. Satyabrata
Updated on 06-Mar-2023 16:48:47

1K+ Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. The matrix in java is nothing but a multi-dimensional array which represents multiple rows and columns. As per the problem statement we have to find the minimum element present in every row of a given matrix of a multi-dimensional array. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original matrix is = { {2, 3, 11, 4, 6}, ... Read More

Convert Hexadecimal to Octal in Java?

Mr. Satyabrata
Updated on 06-Mar-2023 16:39:26

716 Views

Octal Number − Octal number is also one of the number systems available. The octal number is represented with 8 digits which is from 0 to 7(0, 1, 2, 3... 7). The Octal numbers are expressed as base-8 in the numeral system. Hexadecimal Number − Hexadecimal number is also one of the number systems available. The Hexadecimal number is represented with 16 digits which is from 0 to 15(0, 1, 2, 3... 15). From 10 to 15 it is represented as A to F. The Hexadecimal numbers are expressed as base-16 in the numeral system. Here we first convert the ... Read More

How to Check Orientation of 3 Ordered Points in Java?

Mr. Satyabrata
Updated on 10-Mar-2023 16:36:28

253 Views

In this article we are going to find the orientation of 3 ordered points. Here orientation means that the given points form clockwise, anticlockwise or collinear shape in space. In the above diagram a, b, c are the three points which check the orientation of shape in space. We find the orientation of three given points by calculating the slope. To calculate slope and to calculate the orientation of 3 ordered points. Slope of line segmentSlope of line segment $(a, b):\theta=\left ( y_{b}-y_{a} \right )/\left ( x_{b} -x_{a}\right )$ Slope of line segment $(b, c):\phi=\left ( y_{c} -y_{b}\right )/(x_{c}-x_{b})$ And ... Read More

How to Check if the Matrix is a Magic Square in Java?

Mr. Satyabrata
Updated on 06-Mar-2023 15:45:58

3K+ Views

Matrices are nothing but a collection of data elements arranged in a rectangular layout that is two-dimensional. In Java, an array with two dimensions can be considered as a matrix. As per the problem statement the task is to check if the matrix is a magic square or not. A matrix is said to be a magic square if the sum of elements of any row, column or diagonal is equal to a specific number. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose ... Read More

Advertisements