|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.babaroga.test.Utility
public final class Utility
Utility class for general helper methods.
| Method Summary | |
|---|---|
static java.util.List<java.lang.String> |
getLinesFromFile(java.lang.String filename)
Retrieves each line from a text file as a list of Strings. |
static boolean |
isValidImageWriterFormat(java.lang.String format)
Determines if the specified image format can be written. |
static int |
nextPowOf2(int n)
Finds the bitwise next highest power-of-2 of a non-power-of-2 integer. |
static int |
totalArea(java.util.Collection<java.awt.Rectangle> rectangles)
Calculates the sum of the areas of a collection of rectangles. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int nextPowOf2(int n)
n is already a power-of-2 it will be returned as-is.
Note: Since int is a signed integer if n is
Integer.MAX_VALUE (0x7FFFFFFF), the next highest power of 2 is
Integer.MIN_VALUE (0x80000000). Similarly, any negative integer
will overflow to zero.
n - A non-power-of-2 integer.
n that is a power-of-2.public static boolean isValidImageWriterFormat(java.lang.String format)
format - The format extension (e.g. "bmp").
format is a valid image extension.public static int totalArea(java.util.Collection<java.awt.Rectangle> rectangles)
rectangles - The rectangles whose areas will be summed.
public static java.util.List<java.lang.String> getLinesFromFile(java.lang.String filename)
filename - The name of the text file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||