title: How do I get the first n characters of a string without checking the size or going out of bounds?
body: <p>How do I get up to the first <code>n</code> characters of a string in Java without doing a size check first (inline is acceptable) or risking an <code>IndexOutOfBoundsException</code>?</p>