public static double Str2Double(String i) {
if ( i.indexOf(".") >= 0 ) { int p = i.indexOf(".") ; i = i.substring(0,p) ;}
double o ;
try { o = Double.parseDouble(i) ;}
catch (Exception e) { o = 0 ;}
return o ;
}
public static String Double2Str(double i) {
String o ;
try { o = Double.toString(i) ;}
catch (Exception e) { o = "" ;}
if ( o.indexOf(".0") == (o.length()-2) ) { o = o.substring(0, (o.length()-2) ) ;}
return o ;
}
public static double Int2Double(int i) {
double o ;
try { o = (double)i ;}
catch (Exception e) { o = 0 ;}
return o ;
}
####
import java.io.RandomAccessFile ;
...
java.io.File file = new java.io.File( "/tmp/file" ) ;
RandomAccessFile stream = new RandomAccessFile(file , "rw") ;
int len = 1024 ;
String buffer ;
try {
byte[] b = new byte[len] ;
int n = stream.read(b , 0 , len) ;
if (n > 0) {
buffer = new String(b,0,n) ;
}
}
##
##
open(my $io,"/tmp/file") ;
read($io, my $buffer , 1024) ;