Java puzzler - How many Integers do you fit in the box


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package sk.adino.puzzlers;
  2.  
  3. import static org.junit.Assert.*;
  4. import org.junit.Test;
  5.  
  6. public class AutoboxingTest {
  7.  
  8. @Test
  9. public void test() {
  10. int i=1;
  11. while(i<10000000) {
  12. System.out.println("value:" + i);
  13. Integer j=i;
  14. Integer k=i;
  15. if (j==k){
  16. i=i*10;
  17. }else break;
  18. }
  19. assertEquals(i,1000);
  20. }
  21. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.