Revathi Satya Kondra has Published 101 Articles

How to read data from scanner to an array in java?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Dec-2024 23:10:17

12K+ Views

The Scanner class of the java.util package gives you methods like nextInt(), nextByte(), nextFloat(), etc., to read data from the keyboard. To read an element of an array, use these methods in a 'for' loop. Let us have a brief explanation of the methods of nextInt(), nextByte(), and nextFloat() from ... Read More

What is the difference between PATH and CLASSPATH in Java?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Dec-2024 23:03:52

1K+ Views

In Java, the terms Path and ClassPath refer to different things and are used for different purposes. Let's discuss them one by one with a suitable example − Path The path environment variable is used to specify the set of directories that contains execution programs. When you try to execute ... Read More

Floating-point hexadecimal in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Dec-2024 23:03:20

552 Views

In this article, we use the '%a' format specifier to represent floating-point numbers in their hexadecimal form. This is useful when you need precise control over the representation of floating-point values. For Formatter, import the following package − import java.util.Formatter; Now creating a 'Formatter'object to format the data− Formatter ... Read More

Convert Integer to Hex String in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 14-Dec-2024 17:03:48

15K+ Views

In Java, converting an integer value to a hexadecimal (hex) string means transforming the number from its base-10 (decimal) format to base-16 format. This conversion uses digits 0-9 and letters A to F to represent the values. Integer: An integer is a whole number without having a fractional part, ... Read More

Format floating point number in Java

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 13-Dec-2024 13:38:06

4K+ Views

What is Floating Point Number? Floating point number formatting is the process of controlling how floating point numbers (numbers with decimal points) are displayed(printed in a program). For example, if we have a decimal number of 123.45678, the formatted number can be 123.457, 123.46, and 123.5 instead of that number. ... Read More

Count Alternating Subarray

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Jul-2024 11:22:09

250 Views

The Count Alternating Subarrays are used to count the number of subarrays where no two adjacent elements are similar. we can also call these subarrays as alternating subarrays. Problem Statement Before understanding what is "Count Alternating Subarrays" let's see what is a sub-array, and alternating sub-arrays. ... Read More

Program to find the Maximum Prime Difference

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Jul-2024 11:15:12

150 Views

The Maximum Prime Difference is a problem used to determine the largest difference between indices of two prime numbers in a given array. Problem Statement Here, we have given an array of integers as nums. our task is to find the maximum prime difference between the indices of any two ... Read More

Minimum Operations to Make Median of Array Equal to K

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Jul-2024 11:14:32

253 Views

The problem “Minimum Operations to Make the Median of the Array Equal to K” is used to adjust the elements of an integer array so that its median becomes equal to a given value k. In one operation, you can increase or decrease any element by 1. Problem Statement ... Read More

Longest Strictly Increasing or Strictly Decreasing Subarray

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Jul-2024 11:12:00

641 Views

The Longest Strictly Increasing or Strictly Decreasing Subarray problem is used to find the maximum length of the contiguous subarray within a given array where the elements are either strictly increasing or strictly decreasing. Problem Statement Given an array of integers nums, return the length n of the longest subarray ... Read More

Latest Time You Can Obtain After Replacing Characters

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 23-Jul-2024 11:07:00

117 Views

The Latest Time You Can Obtain After Replacing Characters sub-task is applied to an input string, in which the string is represented as a 12-hour format time when the maximum number of characters are replaced by '?'. In a 12-hour format time, "HH:MM” where HH is an element from ... Read More

Advertisements