how to save the value from (char)(serialInt.read()) into a string or int

How do i save the value from (char)(serialInt.read()) into a string or an int?
I want to save the value so i can send that value to the database? instead of this System.out.print((char)(serialInt.read())); i want to save it something like this //int temp = (char)(serialInt.read());, but then it wont let me. im using java
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM15");
//SerialPort puerto = (SerialPort) portId.open("simplewrite", 2000);

SerialPort port = (SerialPort)portId.open("Arduino", 9600);
serialOut = port.getOutputStream();
serialInt = port.getInputStream();
port.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);

while(true)
{

serialOut.write(50);
serialOut.flush();
while(serialInt.available()>0)
{
System.out.print((char)(serialInt.read()));
//int temp = (char)(serialInt.read());

}

serialOut.close();
serialInt.close();
port.close();
}

This isn't an Arduino question. It is a Java question. I will try to answer your question. Try storing the bytes/characters in an array and construct a String from that array. String s = new String(char[ ] value)

how do i store the bytes in an array?could you help me?

I don't know Java. I would use Google or read a book on the topic.