Okay, so it looks like there a number of issues with your code. I'm not sure it would even run.
This line...
int fd = Spi.wiringPiSPISetup(1, 1000000);
...is setting up channel 1 for 1Mhz (which should be fine), but later you are trying to read/write on channel 0 (which has not yet been setup...)
int i Spi.wiringPiSPIDataRW(0, packet, 1);
I also think you need a = in there. int i = Spi.wiringPiSPIDataRW(0, packet, 1);
This line...
byte packet[] = new byte[1];
...looks like it declares an array of 1 byte (?? I'm no java expert ??) but it is not initialized with any value ?
That means you are sending whatever value happens to be in that byte at the time to the SPI bus and reading back it's output...
Finally - I don't think that you get the result in i (if that's what you were expecting ?), the docs for wiringPiSPI say:
- int wiringPiSPIDataRW (int channel, unsigned char *data, int len);
This performs a simultaneous write/read transaction over the selected SPI bus. Data that was in your buffer is overwritten by data returned from the SPI bus.
So the data you are trying to read should end up in packet.
I would spend some more time looking at wiringPiSPI and some of the questions/comments here.