Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to convert String to IntStream in Java
Let’s say the following is our string −
String str = "My String";
Now, convert the above to IntStream −
IntStream stream = str.chars();
Example
Following is the program to convert String to IntStream in Java −
import java.util.stream.IntStream;
public class Demo {
public static void main(String[] args) {
String str = "My String";
System.out.println("String: " + str);
IntStream stream = str.chars();
System.out.println("IntStream...");
stream.forEach(System.out::println);
}
}
Output
String: My String IntStream... 77 121 32 83 116 114 105 110 103
Advertisements