fork(3) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.awt.image.BufferedImage;
  4. import java.util.*;
  5. import java.lang.*;
  6. import java.io.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13.  
  14. int[][] r = {
  15. {0xFF, 0xFF, 0xFF, 0xFF},
  16. {0, 0, 0, 0},
  17. {0, 0, 0, 0},
  18. {0xFF, 0xFF, 0xFF, 0xFF},
  19. };
  20. int[][] g = {
  21. {0, 0, 0, 0},
  22. {0xFF, 0xFF, 0xFF, 0xFF},
  23. {0, 0, 0, 0},
  24. {0xFF, 0xFF, 0xFF, 0xFF},
  25. };
  26. int[][] b = {
  27. {0, 0, 0, 0},
  28. {0, 0, 0, 0},
  29. {0xFF, 0xFF, 0xFF, 0xFF},
  30. {0xFF, 0xFF, 0xFF, 0xFF},
  31. };
  32.  
  33. int width = 4;
  34. int height = 4;
  35.  
  36. BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
  37.  
  38. for (int y = 0; y < height; y++) {
  39. for (int x = 0; x < width; x++) {
  40. int rgb = r[y][x];
  41. rgb = (rgb << 8) + g[y][x];
  42. rgb = (rgb << 8) + b[y][x];
  43. image.setRGB(x, y, rgb);
  44. }
  45. }
  46.  
  47. // Uncomment to save the image
  48. // File outputFile = new File("/output.bmp");
  49. // ImageIO.write(image, "bmp", outputFile);
  50. }
  51. }
Success #stdin #stdout 0.12s 321664KB
stdin
Standard input is empty
stdout
Standard output is empty