Java examples for File Path IO:DataOutputStream
Write float to a file using DataOutputStream
import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) { String strFilePath = "C:/Folder/WriteFloat.txt"; try {/*from ww w. j a v a2s . c o m*/ FileOutputStream fos = new FileOutputStream(strFilePath); DataOutputStream dos = new DataOutputStream(fos); float f = 1.123f; dos.writeFloat(f); dos.close(); } catch (IOException e) { System.out.println("IOException : " + e); } } }