Reversing a decimal number is a favourite programming problem in the technical interviews. Below is the problem statement and the solution implemented in Java. Problem statement Write an optimal program to reverse the digits in a decimal number without converting it to a string. Example: 123.45 -> 54.321
Cut the Sticks is a programming problem and an interview question. The problem statement and the solution are given below. Problem Statement You are given N sticks, where the length of each stick is a positive integer. A cut operation is performed on the sticks such that all of them are reduced by the length of the […]
This tutorial shows you how to generate JSON schema from Java class. We will use an open source library called JJSchema to do the job. To be able to generate the JSON schema properly, the Java class should have getters and setters defined for its members. A JSON Schema is a JSON document that describes the structure […]
This tutorial shows how to split a string in Java. Below, we present three options to split a string in Java namely – with StringTokenizer class, with split() method of the String class and with Pattern class. Each of the options has its utility and advantage over the other. You can use either of them as per your need.