fork(1) download
  1. class Teste2 {
  2.  
  3. public static String[] juntarTodasAsSQLs(String chave, String[] valores) {
  4. String[] novoArray = new String[valores.length];
  5. for (int i = 0; i < valores.length; i++) {
  6. novoArray[i] = "('" + chave + "', '" + valores[i] + "')";
  7. }
  8. return novoArray;
  9. }
  10.  
  11. public static void main(String[] args) {
  12. String chave = "999";
  13. String[] arrayOriginal = {"10", "20", "30", "40"};
  14. String[] resultados = juntarTodasAsSQLs(chave, arrayOriginal);
  15.  
  16. for (String r : resultados) {
  17. System.out.println(r);
  18. }
  19. }
  20. }
Success #stdin #stdout 0.09s 320576KB
stdin
Standard input is empty
stdout
('999', '10')
('999', '20')
('999', '30')
('999', '40')