KodingKid

How to optimise your operators in Java - Basic Scripting #12

May 20th, 2021 (edited)
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. int notOptimisednum = 1;
  2. //this isn't very optimised
  3. byte veryOptimisednum = 1;
  4. //this is very optimised
  5. //bytes can only be between -128 and 127 so if you have to go further than that... then use:
  6. short moreOptimisednum = 1000;
  7. //this is more optimised
  8. System.out.println(notOptimisednum);
  9. System.out.println(veryOptimisednum);
  10. System.out.println(moreOptimisednum);
  11. //just to print the values out now
Add Comment
Please, Sign In to add comment