|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--ereinion.math.BinNumber
Classe che permette di trattare interi di precisione qualsiasi. Il numero � effettivamente memorizzato com un array di byte.
Field Summary | |
static int |
BIN
campo associato con la rappresentazione base 21 del numero (binaria). |
static int |
HEX
campo associato con la rappresentazione base 24 del numero (esadecimale). |
static int |
OCT
campo associato con la rappresentazione base 23 del numero (ottale). |
static int |
QUA
campo associato con la rappresentazione base 22 del numero. |
Constructor Summary | |
BinNumber(byte[] value)
Crea un nuovo BinNumber. |
|
BinNumber(byte[] value,
int offset,
int length)
Crea un nuovo BinNumber. |
|
BinNumber(int value)
Crea un nuovo BinNumber. |
|
BinNumber(int value,
int precision)
Crea un nuovo BinNumber. |
Method Summary | |
static int |
byteToInt(byte value)
Converte un byte (range [-128,127]) in un intero (range [0,255]) |
byte |
byteValue()
|
double |
doubleValue()
|
float |
floatValue()
|
byte[] |
getBytes()
Restituisce questo BinNumber in forma di array di byte. |
int |
getPrecision()
Restituisce la precisione in byte del BinNumber |
static byte |
intToByte(int value)
Converte un intero (range [0,255]) in un byte (range [-128,127]) |
int |
intValue()
|
long |
longValue()
|
short |
shortValue()
|
boolean[] |
toBits()
Restituisce i bits che compongono questo BinNumber. |
java.lang.String |
toString()
|
java.lang.String |
toString(int rep)
Restituisce la rappresentazione richiesta del numero (BIN, QUA, OCT, HEX). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int BIN
public static final int QUA
public static final int OCT
public static final int HEX
Constructor Detail |
public BinNumber(byte[] value, int offset, int length)
value
- l'array di byte da cui leggere il valore.offset
- la posizione da cui cominciare a leggere sull'array.length
- il numero di byte da leggere.public BinNumber(byte[] value)
value
- l'array di byte da cui leggere il valore.public BinNumber(int value)
value
- il valore su cui calcolare il BinNumber.public BinNumber(int value, int precision)
value
- il valore su cui calcolare il BinNumber.precision
- la precisione (in byte) del nuovo BinNumber.Method Detail |
public int getPrecision()
public boolean[] toBits()
public java.lang.String toString(int rep)
BIN
,
QUA
,
OCT
,
HEX
public byte[] getBytes()
public long longValue()
longValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public byte byteValue()
byteValue
in class java.lang.Number
public short shortValue()
shortValue
in class java.lang.Number
public java.lang.String toString()
toString
in class java.lang.Object
public static int byteToInt(byte value)
value
- il byte da convertire.
public static byte intToByte(int value)
value
- l'intero da convertire.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |