1 2 3 4
public static boolean fileContentsEquals(File file1, File file2) { InputStream is1 = null; InputStream is2 = null; ...
Java fileContentsEquals
1 2 3 4
public static int[] zigzagify(int[] array, int xmax, int ymax) { int[] zz = new int[array.length]; //zigzag array if (array.length != xmax * ymax) { ...
Java Zig Zag ordering of array
This is the code that is su...
1 2 3 4
public static String getRelativePath(File file, File relativeTo) throws IOException { /* * windows seems in some cases not to stop getParent() at 'c:\', which I ...
Java get path of a File relative...
I call:
File f = new File(...
1 2 3
/** * Get the article destined for the front page ...
Java Closing database connection...
by junkyjunk,
July 31, 2008 02:35,
4 refactorings, tagged with database, java, javabeans, database leak
I am making a blog for fun ...
1 2 3 4
import java.io.*; import java.lang.Character; // import java.util.HashMap; ...
Java Simple interpreter
So I was trying to condense...
1 2 3 4
public abstract class I18NException extends Exception { public enum Message implements ExceptionMessage { ...
Java Internationalize Exceptions
This is a template for Exce...
1 2 3 4
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; ...
1 2 3 4
import java.util.Scanner; public class AsciiSquare ...
Java ascii square
by kefestetayyus.blogspot.com,
May 09, 2008 12:44,
4 refactorings, tagged with java, ascii, square, basic
Simply prints a square with...
1 2 3 4
/** * This example show how to read from the keyboard and write to the * monitor one char. ! This is only an example ! Use Reader and ...
Java Read and write example
by Gnix,
April 02, 2008 17:58,
No refactoring
An example that use Buffere...
1 2 3
public PreviewTreeModel(Collection<FileDescription> files) { ...
Java Create a tree out of a coll...
I would like to transform a...
1 2 3 4
/** * warning performs a cartesian product * @param list of NameAddress objects ...
Java clean up nested loops?
by getopenid.com/garretokelly,
January 16, 2008 21:10,
6 refactorings
Given a list of NameAddress...
1 2 3 4
public class Car { public static class Builder { ...
Java Fluent Builder
by Jeremy Weiskotten,
December 24, 2007 02:56,
1 refactoring, tagged with java, fluent interface, builder
Here's an example of the Bu...
1 2 3 4
/** * ================================================================ * Enterprise Managerial ...
Java Widget Mirror
by fenix,
December 09, 2007 15:03,
No refactoring, tagged with mirrored, Widget, QWidget, Widget Mirror
Hi at all, I try to reply a...
1 2 3 4
GridBagConstraints c = new GridBagConstraints(); c.insets.bottom = 2; c.insets.top = 2; ...
Java Swing GridBagLayout in calc...
Writing a calculator type a...
1 2 3 4
public class Bus { private String TYPE; private int MAX_RANGE; ...
Java Equals Method
by splinter03.myopenid.com,
November 05, 2007 11:53,
17 refactorings
Hi all,
Ive been doing ...
1 2 3 4
public class Space { private int count; private String varStr; ...
Java Cannot Ref from Static Content
by Mark Webb,
November 09, 2007 14:45,
7 refactorings
If anyone can tell me what ...
1 2 3 4
public class SchoolRoom { private String [] students; ...
Java Help with new methods
by Mark Webb,
November 06, 2007 07:28,
6 refactorings
Having some trouble with th...
1 2 3 4
public class Parks { private String[] parkingBays; private int numCars; ...
Java Errors With Exception
by Mark Webb,
November 05, 2007 07:03,
4 refactorings
It compiles, although when ...
1 2 3 4
import java.util.Scanner; import static java.lang.Math.*; ...
Java Rational numbers
by jujon.myopenid.com,
November 06, 2007 05:13,
3 refactorings
I'm trying to define a clas...
1 2 3 4
package net.alessandropetrozzelli; class InvalidISINCharacterException ...
Java ISIN check digit
based on http://en.wikipedi...
1 2 3 4
import java.util.Scanner; import java.util.Arrays; ...
Java Incompatible Types
by splinter03.myopenid.com,
November 10, 2007 12:44,
2 refactorings
It has some problems incomp...
1 2 3 4
/** * This is a method which will gather the pixels * of the 8 pixels surrounding a given pixel ...
Java Detect neighboring pixels
by Mike,
October 26, 2007 04:21,
5 refactorings
I hate written a method to ...
1 2 3 4
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; ...
Java Email addresses validator
by Hbiloo,
October 11, 2007 11:08,
5 refactorings
This class validates email ...
1 2 3
public static long randomNumber(int min, int max) { return Math.round((Math.random() * (max - min)) + min); }
Java Get a random number within ...
by diskostu,
October 01, 2007 00:50,
8 refactorings
The title sais it: you'll g...
This method checks if the c...