How to Convert a string to date in JAVA ?
Hi, For converting string to a date in JAVA use the following code. import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) throws Exception...
View ArticleJava check memory Allocation
class test { public static void main(String args[]) { Runtime r = Runtime.getRuntime(); long mem1, mem2; Integer someints[] = new Integer[1000]; System.out.println("Total memory is: "...
View ArticleJComboBox in Java swing
This shows you how to add JcomboBox to JPanel import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat; import javax.imageio.ImageIO; import javax.swing.*; public class Example...
View ArticleJava Applet MouseEvents
A simple event based applet applications is described below First importing the necessary header files // Demonstrate the mouse event handlers. import java.awt.*; import java.awt.event.*; import...
View ArticleCreating a JButton component in swing
Java swing provides a native look and feel that emulates the look and feel of several platforms. Here i am going to create a Button and adding it to Frame. For this first create a Jframe object,a...
View ArticleHow to find your Google Plus ID
This is so simple 1. Go to your Google + account (https://plus.google.com/). 2. Click on the Profile icon on the Left. 3. If you look at the URL in the address bar, it should look something like this:...
View ArticleWhat are static variables? Why it is used? What is it’s use? – A Common...
The static keyword is used in java mainly for memory management. We may apply static keyword with variables, methods, blocks and nested class. The static keyword belongs to the class than instance of...
View ArticleReverse a byte array in Android
Here is a simple function to reverse a byte array in android. public static void reverse(byte[] array) { if (null == array) { return; } int i = 0; int j = array.length - 1; byte tmp; while (j > i) {...
View ArticleGiven a sorted array, find the smallest positive integer that is not the sum...
Java public class SmallestPositiveInteger { public static int findSmallestPositiveInteger(int[] nums) { int smallest = 1; for (int num : nums) { if (num <= smallest) {...
View ArticleProblem: There are N prisoners standing in a circle, waiting to be executed…
There are N prisoners standing in a circle, waiting to be executed. The executions are carried out starting with the kth person, and removing every successive kth person going clockwise until there is...
View Article