An Arduino is a much better choice than a Raspberry Pi for tasks that require real-time input and responses. While a Pi can be used for more complex tasks (such as designing a whole-network ad blocker ...
[Brett Killion] did make that combination and wound up with a practical network ... can measure from very low frequencies to 500MHz. [Brett] uses a Python program to process the data from the Arduino.
The Java program can also read an Arduino program file and convert all the print calls in it to use the library, if you like. As you might expect, this requires some cooperation from your program.