Tip Bank

DevX

Write One toString() Method for Most All Your Classes

public String toString(){ StringBuffer sb = new StringBuffer( 256 ); sb.append(“[Field Name] [Value] “); Class curr = this.getClass(); while(curr != null){ Field[] field = curr.getDeclaredFields(); for(int i=0; i

DevX

Use IN in place of OR

If you use OR against a table when you are trying to retrieve rows on matching criteria, it will search the table as many times as matching criteria you gave.

DevX

Using the dir() and the dir$() Functions

It’s possible to use the dir() and the dir$() functions to list directories. However, many programmers handle the two first returns from the functions “.” and “..” by using an

DevX

Set Fraction Digits

To reduce the number of fraction digits in a double type variable, follow the code sample below. This can be useful in money calculations. Firstly, create a NumberFormat instance and

DevX

Don’t Worry about Sorting

It is possible to sort any type of array of elements, even if you don’t know a sorting algorithm. First, pass an array variable to sort the method (which is