package script;
import java.io.*;

import java.util.Calendar;
import java.io.*;
import java.text.SimpleDateFormat;
import java.io.RandomAccessFile;
import java.io.IOException;


public class DateUtils { //This function will give the current date time in our required format
public static final String DATE_FORMAT_NOW = "ddMMyyyy";
public static String now() {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
}

public static void main(String arg[]) {
try{


RandomAccessFile br = new RandomAccessFile("/C:/SMMC/Sources/charge_SMMC_"+ DateUtils.now() +".dat", "rw");//It will create a file at desired location where all files will be merged
RandomAccessFile out = new RandomAccessFile("/C:/SMMC/Destination/charge_SMMC_"+ DateUtils.now() +".dat", "rw");//It will create a file at desired location where all files will be merged

int c,d,e,f,t=0,count=2,r=0;
while ((c = br.read()) != -1){
br.seek(t);
c = br.read();
d = br.read();
e = br.read();
f = br.read();
t++;
br.seek(t);
char c1 = (char)c;

char d1 = (char)d;
char e1 = (char)e;
char f1 = (char)f;
char[] chars = {c1,d1,e1,f1};

String covertedChars = new String(chars);

if (covertedChars.equals("BTS|")){


out.write(c);
out.write(d);
out.write(e);
out.write(f);

//char ch = (char)count;
//out.write(ch);

//out.write("|".getBytes());
t=t+3;
br.seek(t);
f=br.read();
char f2 = (char)f;
while(f2!='|')
{

if(r==0) {

// out.write(count);

r++;
}

t++;
br.seek(t);
f=br.read();
f2 = (char)f;
}
out.write(f);
while ((f = br.read()) != -1) {
out.seek(out.length());
out.write(f);
}


}
}
br.close();
out.close();






} catch (Exception e){
System.err.println("Error: " + e.getMessage());
}
}
}



----------------------------------------------------------------------------------------------------
My problem is I am unable to write integer to file(BEFORE SMILEY), it is using as unicode, Can someone help me with the problem.

Thanks in advance!!