|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umbc.cs.maple.utils.JavaUtils
public class JavaUtils
Various utility functions for Java.
Copyright (c) 2008 Eric Eaton
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Field Summary | |
---|---|
static java.text.DecimalFormat |
format1DecimalPlace
|
static java.text.DecimalFormat |
format2DecimalPlaces
|
static java.text.DecimalFormat |
format3DecimalPlaces
|
static java.text.DecimalFormat |
format4DecimalPlaces
|
Constructor Summary | |
---|---|
JavaUtils()
|
Method Summary | ||
---|---|---|
static int[] |
arrayAppend(int[] objs,
int newObj)
Appends an element to an array. |
|
static
|
arrayAppend(T[] objs,
T newObj)
Appends an element to an array. |
|
static double[] |
arrayCopy(double[] objs)
Copy the given array. |
|
static int[] |
arrayCopy(int[] objs)
Copy the given array. |
|
static
|
arrayCopy(T[] objs)
Copy the given array. |
|
static
|
arrayDelete(T[] objs,
int indexToDelete)
Delete the specified element from the array. |
|
static
|
arrayReverse(T[] array)
Reverses the given array. |
|
static java.lang.String |
arrayToString(double[] v)
|
|
static java.lang.String |
arrayToString(double[] v,
java.text.DecimalFormat df)
|
|
static java.lang.String |
arrayToString(java.lang.String[] v)
|
|
static double[] |
collectionToPrimitiveArray(java.util.Collection<java.lang.Double> collection)
|
|
static int[] |
collectionToPrimitiveArray(java.util.Collection<java.lang.Integer> collection)
|
|
static java.awt.image.BufferedImage |
getBufferedImage(java.awt.Image img)
|
|
static byte[] |
getBytesFromFile(java.io.File file)
|
|
static java.lang.String[] |
parseFileToStringArray(java.lang.String filename)
Opens a file and generates an array of strings. |
|
static long |
totalMemoryMB()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.text.DecimalFormat format1DecimalPlace
public static java.text.DecimalFormat format2DecimalPlaces
public static java.text.DecimalFormat format3DecimalPlaces
public static java.text.DecimalFormat format4DecimalPlaces
Constructor Detail |
---|
public JavaUtils()
Method Detail |
---|
public static <T> T[] arrayAppend(T[] objs, T newObj)
T
- the generic type of the array.objs
- the array.newObj
- the object to append the the array.
public static int[] arrayAppend(int[] objs, int newObj)
objs
- the array.newObj
- the object to append the the array.
public static <T> T[] arrayCopy(T[] objs)
T
- the generic type of the array.objs
- the array.
null
if the array is null.public static int[] arrayCopy(int[] objs)
objs
- the array.
null
if the array is null.public static double[] arrayCopy(double[] objs)
objs
- the array.
null
if the array is null.public static <T> T[] arrayDelete(T[] objs, int indexToDelete)
T
- the generic type of the array.objs
- the array.indexToDelete
- the index to delete from the array.
public static <T> T[] arrayReverse(T[] array)
T
- the generic type of the array.array
- the array.
public static double[] collectionToPrimitiveArray(java.util.Collection<java.lang.Double> collection)
public static int[] collectionToPrimitiveArray(java.util.Collection<java.lang.Integer> collection)
public static java.lang.String arrayToString(double[] v)
public static java.lang.String arrayToString(double[] v, java.text.DecimalFormat df)
public static java.lang.String arrayToString(java.lang.String[] v)
public static java.lang.String[] parseFileToStringArray(java.lang.String filename)
filename
- - the name of the file to open
public static byte[] getBytesFromFile(java.io.File file) throws java.io.IOException
java.io.IOException
public static java.awt.image.BufferedImage getBufferedImage(java.awt.Image img)
public static long totalMemoryMB()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |