Guest User

Untitled

a guest
Jun 27th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. How can I extract the first 4 digits from an int? (Java)
  2. String str = "1234567890";
  3. int fullInt = Integer.parseInt(str);
  4. String first4char = str.substring(0,4);
  5. int intForFirst4Char = Integer.parseInt(first4char);
  6.  
  7. Integer.parseInt(myIntegerString.substring(0, 4))
Advertisement
Add Comment
Please, Sign In to add comment