This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char[] chars = new char[100*1024*1024]; | |
Arrays.fill(chars, 'A'); | |
String text = new String(chars); | |
long start = System.nanoTime(); | |
BufferedWriter bw = new BufferedWriter(new FileWriter("/tmp/a.txt")); | |
bw.write(text); | |
bw.close(); | |
long time = System.nanoTime() - start; | |
System.out.println("Wrote " + chars.length*1000L/time+" MB/s."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ridge.util; | |
import java.io.File; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.security.CodeSource; | |
import java.security.ProtectionDomain; | |
/** | |
* @author : chenxh |