Source:
<code>protected PreparedStatement generateBulkInsertStatement(String table, int rows, String... cols) throws DatabaseException, SQLException { if (rows > 0) { StringBuilder builder, rowbuilder; if (!this.database.getDatabaseProductName().matches(".*(?i:oracle).*")) { <START> rowbuilder = new StringBuilder(2 + cols.length << 1); <END> rowbuilder.append('('); for (int i = 0; i < cols.length; ++i) { rowbuilder.append("?,"); } rowbuilder.deleteCharAt(rowbuilder.length() - 1).append(')'); builder = new StringBuilder(15 + 20 * cols.length + table.length() + (2 + cols.length * 3) * rows); builder.append("INSERT INTO ").append(table).append('('); for (String column : cols) { builder.append(column).append(','); } builder.deleteCharAt(builder.length() - 1).append(") VALUES"); for (int i = 0; i < rows; ++i) { builder.append(rowbuilder).append(','); } builder.deleteCharAt(builder.length() - 1); } else { rowbuilder = new StringBuilder(20 * cols.length + table.length()); rowbuilder.append("INTO ").append(table).append('('); for (String column : cols) { rowbuilder.append(column).append(','); } rowbuilder.deleteCharAt(rowbuilder.length() - 1).append(") VALUES("); for (int i = 0; i < cols.length; ++i) { rowbuilder.append("?,"); } rowbuilder.deleteCharAt(rowbuilder.length() - 1).append(") "); builder = new StringBuilder(30 + (20 * cols.length + table.length()) * rows); builder.append("INSERT ALL "); for (int i = 0; i < rows; ++i) { builder.append(rowbuilder); } builder.append("SELECT 1 FROM DUAL"); } return this.connection.prepareStatement(builder.toString()); } return null; }</code><technical_language>a odd shift operator here. Is goal double cols.length add 2? If so, I feel "2 + cols.length \* 2" is a lot clearer future maintainers performance cost is negligible this code runs once</technical_language>

Target:
protected PreparedStatement generateBulkInsertStatement(String table, int rows, String... cols) throws DatabaseException, SQLException { if (rows > 0) { StringBuilder builder, rowbuilder; if (!this.database.getDatabaseProductName().matches(".*(?i:oracle).*")) { rowbuilder = new StringBuilder(2 + cols.length * 2); rowbuilder.append('('); for (int i = 0; i < cols.length; ++i) { rowbuilder.append("?,"); } rowbuilder.deleteCharAt(rowbuilder.length() - 1).append(')'); builder = new StringBuilder(15 + 20 * cols.length + table.length() + (2 + cols.length * 3) * rows); builder.append("INSERT INTO ").append(table).append('('); for (String column : cols) { builder.append(column).append(','); } builder.deleteCharAt(builder.length() - 1).append(") VALUES"); for (int i = 0; i < rows; ++i) { builder.append(rowbuilder).append(','); } builder.deleteCharAt(builder.length() - 1); } else { rowbuilder = new StringBuilder(20 * cols.length + table.length()); rowbuilder.append("INTO ").append(table).append('('); for (String column : cols) { rowbuilder.append(column).append(','); } rowbuilder.deleteCharAt(rowbuilder.length() - 1).append(") VALUES("); for (int i = 0; i < cols.length; ++i) { rowbuilder.append("?,"); } rowbuilder.deleteCharAt(rowbuilder.length() - 1).append(") "); builder = new StringBuilder(30 + (20 * cols.length + table.length()) * rows); builder.append("INSERT ALL "); for (int i = 0; i < rows; ++i) { builder.append(rowbuilder); } builder.append("SELECT 1 FROM DUAL"); } return this.connection.prepareStatement(builder.toString()); } return null; }