Sum from Java_1 to 100

public class Main {


    public static void main(String[] args) {


        int[] a = java.util.stream.IntStream.rangeClosed(1, 100).toArray();
        int sum = java.util.Arrays.stream(a).sum();


        System.out.println(sum); 
    }


}
//5050

reference

-[Java --java Add from 1 to 100 | teratail] (https://teratail.com/questions/180348)

What to do next

Read Java 8 reference books.

Afterword

I want to be familiar with streams.

Recommended Posts

Sum from Java_1 to 100
From Java to Ruby !!
Migration from Cobol to JAVA
New features from Java7 to Java8
Connect from Java to PostgreSQL
From Ineffective Java to Effective Java
Java to be involved from today
From Java to VB.NET-Writing Contrast Memo-
Java, interface to start from beginner
The road from JavaScript to Java
[Java] Conversion from array to List
[Java] Introduction to Java
Introduction to java
Convert from java UTC time to JST time
Connect from Java to MySQL using Eclipse
From installing Eclipse to executing Java (PHP)
Post to Slack from Play Framework 2.8 (Java)
Java: How to send values from Servlet to Servlet
[Java] Flow from source code to execution
Introduction to monitoring from Java Touching Prometheus
Precautions when migrating from VB6.0 to JAVA
Memo for migration from java to kotlin
Type conversion from java BigDecimal type to String type
Call Java from JRuby
[Java] From two Lists to one array list
Upsert from Java SDK to Azure Cosmos DB
Run R from Java I want to run rJava
Migrate from JUnit 4 to JUnit 5
Connect to Aurora (MySQL) from a Java application
To become a VB.net programmer from a Java shop
Eval Java source from Java
[Java] Connect to MySQL
Migrate from Java to Server Side Kotlin + Spring-boot
How to get Class from Element in Java
Access API.AI from Java
Kotlin's improvements to Java
[Java] How to switch from open jdk to oracle jdk
I want to write quickly from java to sqlite
Introduction to java command
Minecraft BE server development from PHP to Java
Select * from Java SDK to Azure Cosmos DB
Launch Docker from Java to convert Office documents to PDF
Convert Java enum enums and JSON to and from Jackson
[Java] I want to calculate the difference from the date
How to jump from Eclipse Java to a SQL file
How to write Scala from the perspective of Java
[Java] How to extract the file name from the path
6 features I missed after returning to Java from Scala
Java development for beginners to start from 1-Vol.1-eclipse setup
How to change from Oracle Java 8 to Adopt Open JDK 9
[Java] How to erase a specific character from a character string
Generate models from JSON to Swift, PHP, C #, JAVA
[Java] Platforms to choose from for Java development starting now (2020)
Moved from iBATIS to MyBatis3
[Java] How to use Map
Try Spring Boot from 0 to 100.
[Java] How to use Map
Convert Java Powerpoint to XPS
Java adds table to PDF
How to uninstall Java 8 (Mac)
Java to play with Function