Ultimately, I need to make an array of bytes from a string. How to make it beautiful? After all, the usual cast, if in a loop, it would be b [i] = (char) ch [i], but I want to understand with this example how the streams work. So far I could only make an array of ints, it will pass, but so an extra extension was added and then there will be a narrowing.
final int[] ints = str.chars().map(operand -> (byte) operand).toArray(); I have a string in ascii, so 256 characters is enough.
str.getBytes()not suitable forstr.getBytes()? - Nofate ♦