
gnu.util.Misc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of escher Show documentation
Show all versions of escher Show documentation
Escher is a collection of libraries for X Window System written purely in Java.
The newest version!
package gnu.util;
import java.util.StringTokenizer;
/**
* Provide some handy static methods.
*/
public class Misc {
public static final String VERSION = "0.2.0";
//-- copy array
public static double [] copy (double [] src,
int src_offset, int length) {
double [] dst = new double [length];
System.arraycopy (src, src_offset, dst, 0, length);
return dst;
}
public static double [] copy (double [] src, int src_offset) {
return copy (src, src_offset, src.length-src_offset);
}
public static float [] copy (float [] src, int src_offset, int length) {
float [] dst = new float [length];
System.arraycopy (src, src_offset, dst, 0, length);
return dst;
}
public static float [] copy (float [] src, int src_offset) {
return copy (src, src_offset, src.length-src_offset);
}
//-- linearize array
public static float [] linearize (float [] [] src) {
int s1 = src [0].length;
int s2 = src.length;
float [] dst = new float [s1 * s2];
for (int i=0; i 0)
if (Character.isWhitespace (s.charAt (to))) to--;
else break;
return s.substring (from, to+1);
}
//-- system functions
public static void sleep (long millis) {
try {
Thread.sleep (millis);
} catch (InterruptedException e) {} // ignore
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy