Galera bom dia, seria possível alguém me ajudar com um desafio?
isso é um teste para uma vaga de estagio em java.
AQUI COMEÇA O TESTE
Ok… vamos para a terceira etapa. Este programa aqui não se comporta como esperado:
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class Main {
private static final short[][] url = new short[4][4];
static {
url[0] = new short[] {0x77, 0x35, 0x94, 0x00};
url[1] = new short[] {0x34, 0x73, 0xBC, 0x00};
url[2] = new short[] {0x00, 0x24, 0x9F, 0x00};
url[3] = new short[] {0x00, 0x00, 0x00, 0x18};
}
public static void main(String[] args) {
long num = 0;
for (int i = 0; i < 4; i++) {
ByteBuffer bb = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN);
for (int j = 0; j < 4; j++) {
bb.put((byte) url[i][j]);
}
bb.rewind();
num += bb.getInt();
}
System.out.println(Long.toHexString(num) + ".html");
}
}
AQUI ACABA O TESTE.
Sim, não tenho nenhuma informação a mais.
se alguém puder ajudar eu agradeço.
Ao executar o programa, ele dá como resposta 19efccab. Se trocar o LITTLE_ENDIAN para BIG_ENDIAN, dá abcdef18. mas não consigo ver oq isso pode ser.
Obrigado!
