Thanks to @JustinB for his answer in the comments, just thought I should put it here for others to see:
JustinB: "/dev/input/mice outputs 3 bytes, The first byte is the button data, the next two are x and y. Its not java code, but you might find this or this helpful "