We have to work with large size files in Python. If we use the large files, they occupy more space, and it isn't easy to handle the large files too. In such cases, we have a module in Python to work with the large files. The module we can use to handle large files is zipfile. By using this module, we can compress a large file into smaller files in Python. The following is the process that we have to follow for compressing the large files. ... Read More
A duck number is a positive number that contains a zero in it, but the first digit of the number cannot be a zero. For example, 10305, 20050, and 603 are duck numbers, while 0349 and 2987 are not duck numbers, as 0349 starts with 0 and 2987 does not contain 0 in it. The following are the approaches to find the duck number in Java − Using a while Loop Using the contains() operator Let’s understand each approach in detail. Finding Duck Number Using a While Loop In this approach, we take a number as input and ... Read More
In this article, we will learn how to build a simple ATM machine program in Java. This program lets users choose from the options displayed on the screen. Before choosing the options, the user has to enter their ATM PIN for verification. The default PIN will be '1234', which can be changed if needed. If the PIN is wrong, you will be exited from the program. If the PIN is correct, then the user can choose from the following − Java ATM Program Operations The following are the operations that you can perform with the program − ... Read More
Memory mapping is a technique in Java that gives direct access to files through memory (RAM). A memory-mapped file connects disk content straight to RAM, which lets Java applications handle files as memory segments. This makes files to be treated as a large array and is much faster than regular file operations like read() or write(). This requires fewer system calls and makes file operations faster even for very large files. The java.nio package helps us to implement memory-mapped file operations. This package contains the MappedByteBuffer class, which enables efficient file reading and writing from memory. Use cases of memory-mapped ... Read More
A number is a Xylem number if the sum of extreme digits (first and last) equals the sum of its mean digits (all digits except first and last). If the sum of the extreme digits does not match the sum of the mean digits, then it is a Phloem number. We can understand it with the help of examples − Example 1 Take the number 12326: Sum of its extremes is 1+6=7. The sum of its mean digits is 2+3+2=7. Sum of extremes = Sum of mean digits, so it is a xylem number. Example 2 The number is ... Read More
In this article, we will explore different methods to find the season name from the month number in Java. When the user inputs the month number, the output should be the season by the name associated with the month. If the user enters 1 as the month number, the month is January, so the output will be Winter. Given below is the season classification by months Winter: December (12), January (1), February (2) Spring: March (3), April (4), May (5) Summer: June (6), July (7), August (8) Autumn: September (9), October (10), November (11) We can achieve this using several ... Read More
In this article, we will learn about Giuga Numbers and how to write a code to check if a number is a Giuga Number or not in Java. A Giuga number is a composite number N such that for each prime factor p of N, (N/p)-1 is divisible by p. The first Giuga numbers are 30, 858, 1722, 66198, 2214408306, 24423128562, and 432749205173838. Example Lets take N=30. 30 is a composite number, and its prime factors are 2, 3, and 5. ● For p=2: (N/p)-1 to be divisible by p. N is 30, and p here is 2. (30/2)-1=14, ... Read More
The duodecimal number system is also known as the base-12 number system. The decimal system (base-12) uses digits 0-9, while the duodecimal system uses digits 0-9 along with two additional symbols, A and B. In duodecimal, 10 represents 12 , which means 12 in the decimal number system is 10 in the duodecimal system. We often encounter duodecimal in daily life; for example, we have 12 months in a year, 12 zodiac signs, 12 inches in a foot, 12 musical notes in an octave, and we call a group of 12 items a dozen. Representation of duodecimal numbers The duodecimal ... Read More
JDK (Java Development Kit) is a software development kit that contains all the necessary tools and components that are essential to develop a Java application. Whereas BlueJ is an IDE that will make the process of developing a Java application a lot easier. BlueJ requires JDK installed on the system to work with Java applications. Java Development Kit (JDK) The Java Development Kit (JDK) contains all the essential libraries, tools, and all other important things to work with Java. You can’t do programming in Java without JDK. The modern IDEs, like "IntelliJ IDEA" will already be equipped with Java essential ... Read More
In this article, we will learn how to check if two given words are present in a string. This is useful when you need to check for multiple words in the text for different purposes, like searching, filtering, or text analysis. We will explore different approaches on how to implement it in Java, starting from the simple method to more advanced techniques. Example Scenario Consider this string: "Java provides powerful libraries for developers." We want to check if both "java" and "libraries" appear in the text. In this case, the output will be true. 1.Using contains() The contains() method checks ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP