Digital Signal Processing Reference
In-Depth Information
B Java-Noti zen
double abs(double a)
double max(double a, double b)
int abs(int a)
float max(float a, float b)
Tabelle B.1
Methoden und Konstan-
ten der Math -Klassse in Java.
float abs(float a)
int max(int a, int b)
long abs(long a)
long max(long a, long b)
double ceil(double a)
double min(double a, double b)
double floor(double a)
float min(float a, float b)
double rint(double a)
int min(int a, int b)
long round(double a)
long min(long a, long b)
int round(float a)
double random()
double toDegrees(double rad)
double toRadians(double deg)
double sin(double a)
double asin(double a)
double cos(double a)
double acos(double a)
double tan(double a)
double atan(double a)
double atan2(double y, double x)
double log(double a)
double exp(double a)
double sqrt(double a)
double pow(double a, double b)
double E
double PI
die Variable p1 ebenfalls den Wert
56 ! Um dennoch mit dem vollen 8-
Bit-Wert in b rechnen zu konnen, mussen wir Javas Arithmetik umgehen,
indem wir den Inhalt von b als Bitmuster verkleiden in der Form
int p2 = (0xff & b); // p2 == 200
Nun weist p2 tatsachlich den gewunschten Wert 200 auf und wir haben
damit einen Weg, Daten vom Typ byte auch in Java als unsigned byte
zu verwenden. Praktisch alle Zugriffe auf einzelne Pixel sind in ImageJ
selbst in dieser Form implementiert und damit wesentlich schneller als
bei Verwendung der getPixel() -Zugriffsmethoden.
B.1.4 Mathematische Funktionen ( Math -Klasse)
In Java sind die wichtigsten mathematischen Funktionen als statische
Methoden in der Klasse Math verfugbar (Tabelle B.1).
Math ist Teil des java.lang -Package und muss daher nicht expli-
zit importiert werden. Die meisten Math -Methoden arbeiten mit Argu-
menten vom Typ double und erzeugen auch Ruckgabewerte vom Typ
double . Zum Beispiel wird die Kosinusfunktion y =cos( x ) folgenderma-
ßen aufgerufen:
double x;
double y = Math.cos(x);
Search WWH ::




Custom Search