This post implements a previous post that explains how to convert 32-bit floating point numbers to binary numbers in the IEEE 754 format. What we have is some C++ / Java / Python routines that will allows us to convert a floating point value into it’s equivalent binary counterpart, using the standard IEEE 754 representation consisting of the sign bit, exponent and mantissa (fractional part).
Continue reading
Category Archives: Java
Polymorphism in Java
An example:
import java.util.*;
public class JavaPolymorph
{
public void Print()
{ System.out.println( "JavaPolymorph"); }
public static void main(String[] args)
{
JavaPolymorph j1 = new JavaPolymorph();
JavaPolymorph j2 = new SubJavaPolymorph();
j1.Print();
j2.Print();
}
}
public class SubJavaPolymorph extends JavaPolymorph
{
public void Print()
{ System.out.println( "SubJavaPolymorph"); }
}
Java Threads: The Basics
Method 1: Write a class that implements the Runnable interface
(i) Put the thread code in the run() method.
(ii) Create a thread object by passing a Runnable object as an argument to the Thread constructor. The Thread object now has a Runnable object that implements the run() method. Like this: (new Thread(new MyThread())).start();
Continue reading
Mathematical Expression Parsers in Java and C++
Basic Expression Parsing
Click here for advanced expression parsing
When writing your own calculator it is necessary to build a converter that can transform an input mathematical expression such as ( 1 + 8 ) – ( ( 3 * 4 ) / 2 ), into a format that is more suited for evaluation by computers.
Continue reading
Reading Text Files into String Arrays in Java
Some example Java code to read the contents of text file into a string array, line-by-line. Here is the Java class which is used to output the string array after the file location has been passed to it:
Continue reading
Java Collections: The Basics
One long section of code outlining how to use the Java Collections. As per the Java Strings post, this consists of one long code snippet outlining commonly used Java collections such as Hash Maps, Linked Lists etc. As this is ongoing, expect to see newer stuff added as time progresses.
Continue reading
Java Strings: The Basics
One long section of code outlining how to achieve some basic string handling objectives in Java. Currently trying to get to grips with this language after spending far too many years concentrating on C++. Each technique is demonstrated with a code snippet. As with a lot of my other stuff, any new stuff I find useful will get added at a later date:
Continue reading
Getting Started with Java in NetBeans
Getting Started with Java in Eclipse
1. Open Eclipse and create a new project
Select File -> New -> Java Project. Give your project a name and change the default locxation of the folder location, if desired. Click the Finish button:

