Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Tuesday, 30 January 2024

Understanding Structured Programming: A Foundation for Code Clarity and Control

 

Structured programming is a way of writing computer programs that focuses on making them clear and easy to understand. It does this by using lots of smaller parts called subroutines or functions, along with blocks of code and loops (like "for" and "while" loops).

 

In a structured program, the main program is split into many functions, and each one does a specific job. These functions can also use other functions. This approach helps in making programs that are of better quality, easier to read, and faster to develop.

 

Prior to structured programming

Before structured programming became popular in the late 1950s and early 1960s, most programming was done in a unstructured way. This wasn't really a single, organized method, but more like a mix of different ways of writing programs that didn't have the organized and clear rules that structured programming brought in. Here are some main points about unstructured programming:

 

1.   Using a lot of GOTO statements: In unstructured programming, there was a big emphasis on GOTO statements. These let the program jump around to different parts at any time. This often led to messy and complicated "spaghetti code" that was hard to follow, with lots of jumps and connections. This made it really tough to understand, fix, and look after the code.

2.   Limited use of control flow statements: In unstructured programming, even though control structures like if-else were available, they weren't used as much or in a standard way like in structured programming. This resulted in using GOTO statements for simple decisions and loops, which added to the complexity and made the program harder to manage.

3.   Widespread use of global variables: In unstructured programming, there was a strong reliance on global variables, which any part of the program could access. This approach, without specific scopes, limited the program's modularity and created strong links between different parts of the code. As a result, it was easier to accidentally change things and cause unpredictable outcomes.

4.   No modularity: Programs in unstructured programming were often composed of big, single-piece blocks of code with little organization. This approach made it difficult to use the same code again in different parts or to work together effectively on the same project. As a result, it was harder to develop and maintain these programs efficiently.

5.   Emphasis on machine architecture: Unstructured programming often reflected the underlying architecture of the computers of the time, focusing on direct manipulation of memory and hardware details. This made code less portable and adaptable to different machines and operating systems. Example: Assembly language is a low-level language directly interacts with the computer's hardware and instructions.

While unstructured programming played a key role in the early days of computing, it ultimately reached its limitations due to the issues mentioned above. The adoption of structured programming with its emphasis on clarity, control, and modularity represented a significant step forward in software development, leading to more reliable, maintainable, and efficient code.

 

Problems with Unstructured Programming

1.   Tangled Code: Programs often didn't have a well-defined structure, looking more like a jumbled mix of GOTO statements and jumps. This made them hard to follow, maintain, and fix.

2.   Unpredictable Flow: The overuse of GOTO statements created chaotic and hard-to-predict paths through the code, which raised the chances of mistakes and surprising outcomes.

3.   Problems with Data Handling: The common use of global variables created strong dependencies and accidental changes in the code, leading to errors and unstable programs.

4.   Ineffecient Development: The repetitive nature of the code and the lack of organized sections made it harder to work efficiently and collaborate with others.

 

Key concepts of structured programming

1.   Structured programming guides how a program runs using three key concepts or tools:

 

a.    Sequential execution: The program runs commands in the exact order they appear in the code.

b.    Conditional statements (if-else): This lets the program choose between different actions depending on certain conditions. If a condition is met, it follows one group of commands; if not, it takes a different path.

c.    Loops (for, while): These are used to repeat actions in the program several times, usually until a specific condition is fulfilled.

2.   Use of Subroutines or Functions: In structured programming, there's a strong focus on using subroutines, also called functions or procedures. This approach helps in reusing code and keeping it organized into separate modules. Each subroutine is designed to perform a particular task and can be tested separately from the rest of the program, making it easier to manage and debug.

3.   Using Local Variables and Scope: Structured programming involves using local variables within specific subroutines or code blocks. This method helps keep different parts of the program separate, cutting down on interdependencies and the likelihood of mistakes. In this setup, each section or function has its own defined scope.

4.   Clear Control Flow: Structured programming uses loops and conditional structures for controlling program flow, rather than relying on goto statements, which can create messy code. This approach enhances the readability of the code. While programming languages might still have goto statements, their use is generally limited. For more insights, you can read the paper https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf  to get more information

5.   Breaking Down the Problem: In structured programming, you start by outlining the big picture of your program and then gradually split it into smaller, more specific parts. This step-by-step refinement helps in handling complex programs more easily, making them easier to understand and develop.

6.   Use of Global Variables: In structured programming, global variables are often used to hold data that different functions within the program might need. This is straightforward for small programs, but in larger ones, it can lead to issues and make the code more difficult to manage.

 

Example of structured programming

Imagine writing a program to calculate the area of different shapes. Using structured programming, you could define separate functions for calculating the area of a square, rectangle, triangle, and so on. Each function would take the necessary dimensions as input and return the calculated area. The main program could then prompt the user for the desired shape and dimensions, call the appropriate function, and display the result.

 

ShapeAreaCalculator.c 

#include <stdio.h>

// Function prototypes
double squareArea(double side);
double rectangleArea(double length, double width);
double triangleArea(double base, double height);
void calculateAndDisplayArea();

int main() {
    // Call the function that handles the area calculation and display
    calculateAndDisplayArea();
    return 0;
}

// Function to calculate the area of a square
double squareArea(double side) {
    return side * side;
}

// Function to calculate the area of a rectangle
double rectangleArea(double length, double width) {
    return length * width;
}

// Function to calculate the area of a triangle
double triangleArea(double base, double height) {
    return 0.5 * base * height;
}

// Function to handle user input, calculate and display the area
void calculateAndDisplayArea() {
    int choice;
    double area, side, length, width, base, height;

    printf("Choose a shape to calculate the area:\n");
    printf("1. Square\n2. Rectangle\n3. Triangle\n");
    printf("Enter your choice (1-3): ");
    scanf("%d", &choice);

    switch (choice) {
        case 1: // Square
            printf("Enter the length of the side of the square: ");
            scanf("%lf", &side);
            area = squareArea(side);
            printf("Area of the square: %.2lf\n", area);
            break;

        case 2: // Rectangle
            printf("Enter the length and width of the rectangle: ");
            scanf("%lf %lf", &length, &width);
            area = rectangleArea(length, width);
            printf("Area of the rectangle: %.2lf\n", area);
            break;

        case 3: // Triangle
            printf("Enter the base and height of the triangle: ");
            scanf("%lf %lf", &base, &height);
            area = triangleArea(base, height);
            printf("Area of the triangle: %.2lf\n", area);
            break;

        default:
            printf("Invalid choice.\n");
    }
}

Sample Output

Choose a shape to calculate the area:
1. Square
2. Rectangle
3. Triangle
Enter your choice (1-3): 2
Enter the length and width of the rectangle: 10 35
Area of the rectangle: 350.00

 

This program defines calculateAndDisplayArea function encapsulates the logic for prompting the user, receiving input, calculating the area, and displaying the result. Based on the user input, the call goes to squareArea, rectangleArea, triangleArea functions.

 

Popular structured programming languages

1.   C,

2.   Pascal,

3.   Ada,

4.   ALGOL,

5.   PL/I (Programming Language One).

 

Even though Java and Python supports object-oriented features, its core structure reflects a strong foundation in structured programming principles.

 

Benefits of Structured Programming

1.   Code is easy to understand and debug: The code is well-arranged and follows a straightforward path, which makes it simpler to grasp the program's operations and pinpoint potential errors.

2.   Modular and Reusable: Functions can be reused in different programs, reducing redundancy and promoting code maintainability.

3.   Enhanced Readability: Programs written with this approach are easier to read and understand.

4.   Easier Testing and Debugging: The modular nature and separation of different parts of the program make testing and fixing issues more straightforward.

 

Drawbacks of Structured Programming

1.   Handling Complexity: As programs become bigger and more complex, managing global variables and function calls can become challenging.

2.   Less expressive: Compared to object-oriented and functional programming, structured programs are less expressive and might not be used for solving certain types of problems.

3.   Limited code reusability: Although structured programming allows for subroutine reuse within the same program, it doesn't naturally offer ways to easily reuse code across multiple programs. This is in contrast to Object-Oriented Programming (OOP), which focuses on objects and inheritance to facilitate code reuse.

 

In summary, structured programming laid the groundwork for further advancements in programming techniques, including object-oriented and functional programming.

 

 

                                                             System Design Questions

Tuesday, 18 October 2022

Find the smallest digit and its positions in a given number

Problem statement

Given a number as input, you need to find the smallest digit in the given number and its positions.

 

Following program takes an integer as input, traverse to each digit of the number, and get the smallest digit and its positions (positions are from 0 indexed).

 

Find the below working application.

 

SmallestDigitDemo.java

package com.sample.app;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class SmallestDigitDemo {

	static class MinValueAndPosition {
		int number;
		List<Integer> positions;
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println("Enter an integer : ");
			int number = scanner.nextInt();

			if (number < 0) {
				number = number * -1;
			}
			final String str = Integer.toString(number);
			final MinValueAndPosition minValueAndPosition = getMinimumDigigPositions(str);
			System.out.println("Minimum value : " + minValueAndPosition.number);
			System.out.println("position - " + minValueAndPosition.positions);
		}

	}

	static MinValueAndPosition getMinimumDigigPositions(final String num) {
		final List<Integer> list = new ArrayList<>();
		int minVal = Integer.MAX_VALUE;
		int counter = -1;
		for (char ch : num.toCharArray()) {
			counter++;
			int val = Integer.parseInt(ch + "");

			if (val < minVal) {
				minVal = val;
				list.clear();
				list.add(counter);
				continue;
			}

			if (val == minVal) {
				list.add(counter);
			}

		}

		MinValueAndPosition minValueAndPosition = new MinValueAndPosition();
		minValueAndPosition.number = minVal;
		minValueAndPosition.positions = list;
		return minValueAndPosition;

	}
}

Output

Enter an integer : 
1234512341
Minimum value : 1
position - [0, 5, 9]


You may like

 

Saturday, 12 July 2014

Miscellaneous

      Open URL in Java
      Shutting Down Computer
      Convert time stamp to Date Format
      Find processes in Windows using Java
      Find processes in Windows using Java
      Robot : Write Data to Notepad
      How to close the window in awt
      Get the Machine Details in Java
      Ping Command in Java
      Current Working Directory in Java
      Create Directory in Java
      When is the ArrayStoreException thrown?
      Get Operating System Bit type in windows
      Run System Command in Java
      HeadlessException
      Check Version Of Java
      Get all available fonts in your system
      Get font Family names in your system
      Absolute Positioning in Java
      What does Container.validate() method do?
      Find Default Char set in Java
      Convert Byte Array to String
      Supported Character Encodings in Java
      UniCode
      Display Unicode Characters in Java
      UnsupportedEncodingException
      Unicode support for Java
      surrogate pair in Java
      strictfp
      Exception Parameter
      PatternSyntaxException
      SuppressWarnings Annotation Values by Ecilipse
      ServletConfig Vs ServletContext
      When is destroy of servlets called?
      what is the use of servlet config object ?
      Reifiable Types
      Heap Pollution
      Functional Interface
      ElementType
      Call C Program from Java
      Call cpp program from java
      NoSuchAlgorithmException
      InvalidParameterException
      Get all the registered providers
      java.security.NoSuchProviderException
      java.security.InvalidAlgorithmParameterException
      InvalidKeyException
      InvalidKeySpecException
      Java is pass by value or pass by reference ?
      Difference between HashMap and HashTable
      What is Memory Leak in Java?
      Generate random numbers in between min and max
      Lapsed listener problem
      Compare Strings in Java
      convert string to int in Java
      Get current stack trace in Java
      StringBuilder Vs StringBuffer
      wait() Vs sleep()
      How to check 64bit or 32 bit JVM
      Why Java don't have destructors
      Fail Fast Iterator
      Fail Safe Iterator
      Fail fast Vs Fail Safe iterator
      Cloning in Java
      ConcurrentModificationException
      Can an abstract class have constructor ?
      Cause Of StackOverflowError ?
      Remove entries from HashMap while iterating
      Cloning Vs Creating new Object
      Convert List to Set
      convert List to Integer array in Java
      ClassNotFoundException
      NoClassDefFoundError
      NoClassDefFoundError Vs ClassNotFoundException
      Check whether thread holds lock on object ?
      Array Vs ArrayList
      Get key from value in HashMap
      Download file from Internet using Java
      convert character to string in java
      NotSerializableException
      Number of processors available to JVM
      Kill thread in Java
      UnsupportedClassVersionError
      Strings in switch Statements
      Full qualified name of the class
      NoSuchFieldException
      IllegalAccessException
      How to synchronize Map
      How to synchronize List
      How to synchronize Set
      Assert keyword
      AssertionError
      Can a constructor be private in Java ?
      parseInt Vs valueOf
      Blank Final Variable
      Get Java Vendor information
      FHow to take thread dump from JVM
      Get File path separator
      Get Java class path
      Get the Installation directory of JRE
      Get JRE vendor URL
      Get JRE version number
      Get the Operating system architecture
      Get Operating System name
      Get the Operating System Version
      Get the User working directory
      Get the User home directory
      Get User account name
      Can we define abstract class without abstract methods in Java
      Immutable Objects
      Skip Lists
      What is rt.jar file in Java?
      Get the Version Of Ant
      transient keyword
      serialVersionUID
      InvalidClassException
      Serialization Vs Externalization
      Java program to display data and time
      Java Properties file
      Arrays. asList method
      Convert yyyy-MM-dd HH:mm:ss.SSS format to date object
      Convert yyyy-MM-dd HH:mm:ss.SSS format date to long value
      Convert long value to yyyy-MM-dd HH:mm:ss.SSS format
      Pass java object as HTTP post data
      Class Loaders
      What does Class.forName do exactly?
      Add JavaEE perspective to eclipse
      Create dynamic web project in eclipse
      Configure tomcat server in eclipse
      Generate universal unique identifiers in Java
      Compress and archive files in zip format
      Decompress files from zip file
      UncaughtExceptionHandler in Java
      StringWriter in java
      Crack pdf password using Brute Force technique
      Eclipse Memory Analyzer Tool (MAT)
      Dictionary Attack
      Getting JVM heap size, used memory and Total Memory
      ThreadLocal class
       Kill a process on a port in ubuntu
      How to sort List in Java
      Install maven plugin in eclipse
      EclEmma code coverage tool
      install mysql on ubuntu
      javap : disassemble class files
      Difference between java and javaw
      Concatenate two Generic Arrays
      Apache Tiles
      Message Digest functions
      Java MessageFormat class
      CodePro Tutorial
      Eclipse Short cuts
      Java program to Extract private, public key from keystore
      keytool Extract private and public key from keystore
      Generate secret AES key in Java
      Convert secret key into String in Java
      Convert String to secret key in Java
      Generating secret keys in Java
      Public, private key generation in Java
      Export public key certificate from keystore
      Convert byte array to private, public keys
      Digital Signature tutorial java
      java.util.Objects class
      Java8: Group By implementation in java
      Convert java.util.stream to map
      Java8: for loop to forEach function
      ClassName.this : Access instance of enclosing class
      Code formatting short cut in Android studio
      Newly created folders are not visible in android studio
      Character: isDigit: Is character is a digit
      Simplest way to print array in Java
      Java program to validate IPV4, IPV6 addresses
      Add new maven archetype in eclipse
      File utilities application using Guava package
      Calculating MD5 and SHA values in Java
      Check contents of two files are equal or not
      Get current project classpath
      Project Lombok
      Lombok not showing getters and setters
      JD: Java Decompiler
      linux: tree command code
      Setting MySql root password after installation
      Read input from console
      Display list of countries in Java
      Display list of languages in Java
      Setting role based security in tomcat
      Find all available ports
      Difference between System.out and System.err
      Encrypt and decrypt XML file in Java
      Java csv file processing
      Java: write to csv file
      Java: Read csv file
      Is HTTP Pipelining help?
      Reading pkcs12 certificate information
      Run multiple tomcat instances on one machine
      Java cacerts file
      Create Password Protected zip file in Java
      Setting Up WhatsApp on Your Computer
      List of cities in India
      List of cities in Papua New Guinea
      Java Send mail via gmail
      Java: Capture screenshot programmatically
      Place a file in project class path
      MutabilityDetector: Check Immutability property of classes
      Watching a directory for changes in Java
      Java Preferences API tutorial
      Internationalization using ResourceBundle
      Runtime.addShutdownHook(): Run code at JVM exit
      Accessing meta data of a file (All attributes of file)
      Set Unique Identifier to File in Java
      Set File permissions in Java
      File Tail implementation in Java
      Launch URI Scheme over java file
      DigestInputStream & DigestOutputStream Example
      Move file to recycle bin
      Generate content hash of a file
      HOW TO GENERATE SHA1 HASH VALUE OF FILE
      HOW TO GENERATE MD5 HASH VALUE OF FILE
      List contents of a zip file
      Load Client Certificates from Windows Operating system
      Replace first occurrence of a string in Java
      Load Client Certificates from MAC Operating system
      How to detect Operating System in Java?
      How to detect OS uses KDE or Gnome environment in Java?
      Remove square brackets from IPV6 address in Java
      Split file path using system file separator symbol
      Split the string using file Path separator
      File.separator vs File.pathSeparator
      How to Change Eclipse Default Web Browser
      How to encode url in java?
      How to decode url in java?
      Check encoding scheme supported or not in java
      Get package specific information
      Change context root of a dynamic web project in Eclipse
      Increase tomcat server time out in Eclipse
      Access web application with domain name instead of localhost/ipaddress
      Map localhost and port to a domain
      Convert json string to map
      Java CipherOutputStream example
      Java CipherInputStream example
      Encrypt and Decrypt file/stream in Java
      Print all the file names recursively
      Office URI Scheme
      Serialize the object to byte array
      Deserialize byte array to java object
      Convert query string to name value pair
      Convert epoch to human readable format
      Delete a directory recursively in Java
      How to generate random bytes in Java?
      How to Get Client Certificate from HttpServletRequest
      Keytool: Create and export self-signed certificate
      Convert certificate into base64 encoded array
      Convert encoded byte array to certificate
      Convert certificate into base64 encoded string
      Convert base64 encoded string to certificate
      How to set proxy settings for https, http communication
      Get x.509 certificate from encoded string
      How to write multiple input streams to a file
      Base64 encoding and decoding in Java
      How to chain multiple different InputStreams into one InputStream
      Get Enumeration from Java List
      A short tutorial on FindBugs
      Create XML sitemaps in Java
      How to parse ATOM/RSS feed using Java?
      How to get all the options that your jvm accepts?
      How to increase application heap size in Eclipse?
      How to resolve Eclipse out of memory error?
      Working with RandomAccessFile in Java
      Convert xml document to string
      Pretty print xml string in java
      Working with PMD in Eclipse
      Checkstyle in eclipse tutorial
      ProcessBuilder: Execute system commands
      Get all the month names in Java
      Get week names in Java
      Get all the currencies supported in Java
      Get country and the currency of the country
      jsizer: Visualize the complexity of java project
      How to limit number of requests?
      How to view packages as folder structure in eclipse?
      Comment multiple lines in Eclipse
      Check if a double is infinite in Java
      Eclipse: How to change to dark theme
      Eclipse: web.xml is missing and is set to true
      How to upgrade Eclipse IDE?
      How to check whether given character is part of Java identifier variable name or not?
      Check given string is valid java identifier or not
      Java write to a file using BufferedWriter
      Java write to a file using FileWriter
      Convert the current time to HOURS:MINUTES:SECONDS:MILLISECONDS format
      Java: Get alphabets of all the supported languages
      Which languages has lower and upper-case letters
      Which languages do not have both lower and upper-case letters
      Get year, date, day, time from Calendar
      Groovy: Convert json to object and object to json
      Convert byte array to hexa string
      Java: Programmatically import certificate to cacerts file
      Apache commons io: Download a file from url
      Java: Escape string using html entities
      Java: Convert throwable to string
      Create simple Block chain using java
      Block Chain: Create a wallet and transfer coins from one wallet to other in Java
      String to byte array
      Standard Character Set
      Byte array to string
      Default character encoding
      IntegrCache
      Convert xml file to csv
      Shuffle characters in a string
      Concatenation of two characters return an integer
      Bidirectional Map
      Number of weeks between two dates
      Number of Months between two dates
      Number of Days between two dates
      Number of Years between two dates
      Number of Hours between two dates
      Number of Minutes between two dates
      Number of Seconds between two dates
      Redirect System.out.println statements to a stream or file
      Redirect System.err.println statements to a stream or file
      How to add days to a date in Java?
      Check whether given date is valid or not
      Regex to check immediate repeated characters in a string
      Is Java primitive data types stored in stack or heap?
      Can I cast a null to reference type in Java?
      Generate java classes from xsd file
      String equals vs compareTo
      Convert String to char array
      Convert String to Character array
      Ordered vs sorted collection
      Convert byte to binary string
      Convert integer to binary string
      Evaluate mathematical expression given in string form
      Append text to a file
      Create and write text content to a file
      Create and write byte array to a file
      Read plain text file in Java
      Shuffle the elements of array in Java
      Set time out on specific block of code
      Compile multiple java files in one line
      Show only n digits after decimal point
      Check for positive integer using regular expression
      Is BigInteger has any limit?
      Reverse words in a sentence
      Copy contents of directory to other directory
      Copy file from one location to another
      Search for files in a folder
      Print all the file names in a directory and sub directories
      Read last n lines of a file
      What is NumberFormatException?
      Convert hexa string to byte array
      Convert string to hexa string
      Convert integer to hexa string
      Convert hexa string to integer
      Convert long to hexa string
      Convert hexa string to long
      Get the path of running Java class
      Search for an element in the array
      Generate random alpha numeric string
      Write Properties to System.out
      Escape equal sign in properties file
      Delete elements of list while iterating
      Why byte = byte + 1 is not compiling?
      Repeat string n times
      Increment the date by one day
      Pad integer with zeros
      How to create ArrayList from Array
      Get path to System desktop
      How to get the current directory path?
      Open a file
      Convert InputStream to ByteArray
      Convert file to byte array
      Get date and time for given time zone
      Get all supported time zones
      Print float value without scientific notation
      Print double value without scientific notation
      How to create a jar file
      Java: Get content hash of the file
      AES Symmetric encryption example
      Validate xml file against xsd schema
      Convert string to CharSequence
      Read file content as string
      Sort an array in ascending order
      Sort array in descending order
      How to convert int[] to Integer[] in Java?
      How to convert int[] to List in Java?
      How to convert byte[] to Byte[] in Java?
      How to convert byte[] to List in Java?
      How to convert short[] to Short[] in Java?
      How to convert short[] to List in Java?
      How to convert long[] to Long[] in Java?
      How to convert long[] to Long[] in Java?
      How to convert float[] to Float[] in Java?
      How to convert float[] to List in Java?
      How to convert double[] to Double[] in Java?
      How to convert double[] to List in Java?
      How to convert char[] to Character[] in Java?
      How to convert char[] to List in Java?
      How to convert boolean[] to Boolean[] in Java?
      How to print integer in binary format?
      How to print integer in octal format?
      How to print integer in hex format?
      Convert Stream to Iterable
      How to escape html in java?
      Replace 2 or more spaces with single space in a string
      Get milliseconds from LocalDateTime
      Convert uri query parameters to a map of name, value
      How to get UTF-8 String literal constant?
      Get number of seconds from Jan 1st 1970
      Read file content as string in one line
      How to get sub array or part of array
      Get file name by removing extension
      System getProperties vs getenv
      What are -Xms and -Xmx parameters while launching java application?
      Get Generic type of a list
      How to get generic types of map in Java?
      How to get value type of map in Java?
      How to get key type of map in Java?
      How to get the content type of a list?
      Parse XML String in Java
      Convert Eclipse java project to maven project
      Eclipse: Enable break point when exception thrown
      Pad string with stars
      Pad 0’s to binary representation of integer
      Left pad a string with zeros
      Convert UTF-8 byte array to string
      Convert string to UTF-8 byte array
      Convert ISO_8859_1 byte array to string
      Convert string to ISO_8859_1 byte array
      Convert US_ASCII byte array to string
      Convert string to US_ASCII byte array
      Convert UTF_16 byte array to string
      Convert string to UTF_16 byte array
      Convert UTF_16BE byte array to string
      Convert string to UTF_16BE byte array
      Convert UTF_16LE byte array to string
      Convert string to UTF_16LE byte array
      Convert UTF-16 unicode characters to UTF-8 in java
      Reverse an integer array
      Concatenate two byte arrays
      Convert Object array to String array
      Check whether given character is whitespace or not
      Check given character is letter or not
      Get Date from Unix timestamp
      Get Instant from Unix time stamp
      Get Calendar from Unix time stamp
      Set Default time zone to the application
      Integer vs int
      Sort the files by their last modified date
      Sort files by their name
      Sort files by their size
      Get File size in java
      Get File size in java
      List files by their created time
      Create file parent directories if they are not exist
      Convert iterator to list
      How to check BigDecimal is greater than 0?
      How to compare two BigDecimals?
      Convert list to map using streams
      Ignore duplicates while producing map from a stream
      Get file name from absolute path
      How to get java.sql.TimeStamp in Java?
      Format float to n decimal places
      Convert a char to integer
      Read input using Scanner
      How to print double value without scientific notation?
      Convert Object to int
      Count number of lines in a file
      Convert int to Long
      Convert Float to a string
      Convert string to float
      What are connecting characters in Java while defining identifiers?
      String.replace vs String.replaceAll
      How to set time zone for java.util.Date
      Format Instant to String
      Round BigDecimal to n decimal places
      Convert Calendar to yyyy-MM-dd format
      Get LocalDate from long epoch time
      Get LocalDateTime from long epoch time
      Display number from 0-9 in two digits
      Compare two dates without time portion
      Convert LocalDate to Date
      Convert Double to String
      Java: remove oldest elements from the Queue
      How to pretty print a map content in Java?
      Java: Replace spaces by new line character
      Java: Convert integer to byte array
      Java: Get native byte order of the underlying platform
      Java: Convert byte array to an integer
      Java: How to evaluate a mathematical expression?
      How to create an array of N random bytes
      Convert ASCII code to equivalent character
      Java: Implement command line progress bar
      Handle parameterized error messages using MessageFormat class
      Check whether my application is running on windows system or not
      Sign a jar file using jarsigner tool
      How to get the decimal grouping character for given locale?
      Command to check CPU temperature in Mac
      Quick guide to Java DecimalFormat class
      Compress and decompress a string in Java
      Discover and load the implementations of a service using ServiceLoader in Java
      Code Formatting Control in Java: Using @formatter:off and @formatter:on
      No HTTP. No Sockets. Then How Do Programs Communicate? Enter stdio Transport
      SSRF Protection Done Right: DNS, IP Normalization, and Cloud Metadata Defense