Java - Convert Image to Binary (Two Colours/Black & White) Is it possible to convert a .jpg image to binary using Java?

I have asked a similar question on StackOverflow but thought that maybe this may be a good place to ask, too.

I am currently able to convert an image to negative in Java, but am unable as of yet to figure out a way of converting it into binary.

Any suggestions - and even sample code - would be amazing.

Many thanks.
Converting it to "negative" will give you single channel result (0-255). To convert this image to binary, you need thresholding. This threshold value will have a HIGH (0-255) and LOW (0-255). These values are dependent on your application (what you wish to segment). For instance, you could setup an empty image structure and set all values to '0'. Set '1' to channel values that fall between HIGH and LOW. However, remember that performing naive segmentation like this may not give you good results.