You can use JDBC batch inserts.
PreparedStatement ps = cn.prepareStatement("INSERT INTO....");
for (int i = 0; i < 1000; i++) {
    ps.setString(1, "value-" + i); // Set values
    ps.addBatch();                 // Add this to the batch
    ps.clearParameters();          // Reset the parameters
}
ps.executeBatch();
However MySQL's does not support batch insert functionality natively, so to get reasonable performance you will need to add rewriteBatchedStatements=true to your mysql jdbc configuration.  
There is also a MySQL specific batch insert syntax that you could use if you want to create a big SQL string.  I would try both and test the performance.
INSERT INTO x (a,b)
     VALUES ('1', 'one'),
            ('2', 'two'),
            ('3', 'three');
Be careful with both approaches as you may exceed the maximum packet size for a single request.  You may need to set a batch size that is different to the number of entries in your buffer.  E.g. you may need to split 1000 entries across 10 batches of 100.