Problem in creation of File with random numbers

hi all,
i have written a function which generates random num,ber and stores in a text file.
public static void main(String[ ] args) {
int count=0;
System.out.println("Generate Files");
Random R=new Random();
File F= new File("C:/e.cartesian");
try{
FileWriter fw=new FileWriter(F);
int c=0;
int rand=200;
int l=0;
for(int i=0;i<3;i++)
{    for(int j=0;j<5;j++)
{   for(int k=0;k<80;k++)
c+=1;
double d=R.nextDouble()*100;
Double D=new Double(d);
int dtoi=D.intValue();
float itof=(dtoi/(float)100.0)+R.nextInt(200)+l;
Float f=new Float(itof);
fw.write(f.toString()+" ");
System.out.println(f.toString());
fw.write("\n");
count+=1;
l+=200;
System.out.println("Count==>"+count);
}catch(IOException e){}
Problem is , if i run this code with condition k<79 or some other smaller value than 80 it doesnt save any value in text file.

If you close the file after writing it works: fw.close();

Similar Messages

  • Problem with Purchase Order creation with Random numbers .

    Hi Experts
    Currently i am facing an issue with Bapi BAPI_PO_CREATE1 to create Purchase order with random numbers for example items 1, 3,5.
    Please let me know the settings .
    Thanks in Advance

    Hi Neha,
    A reset of the release strategy only takes place if
    -  the changeability of the release indicator is set to '4' in
       case of a purchase requisition and '4' or '6' in case of
       another purchasing document (purchase order, request for
       quotation, contract, scheduling agreement),
    -  the document is still subject to the previous release
       strategy,
    -  the new TOTAL NET ORDER VALUE is higher than the old one.
    The total net order value is linked to CEKKO-GNETW for a purchase order,
    CEBAN-GSWRT for a purchase requisition item-wise release and CEBAN-GFWRT
    for a purchase requisition overall release.
    If you have maintained a Tolerance for value changes during release
    (V_161S-TLFAE), the release strategy is reset when the value of the
    document is higher than the percentage you have specified and if the
    document is still subject to the previous release strategy.
    Review the SAP note 365604 and 493900 for more
    information about Release strategy.
    Regards,
    Ashwini.

  • Story does not correctly export fdx file with scene numbers? Bug needs to be fixed.

    Story does not correctly export fdx file with scene numbers? Bug needs to be fixed.

    Okay, Even if i remove the scene numbers from Story and export the file to Final Draft 8. The format in incorrect. The "transitions" ex. CUT TO:  are not in the correct allignment. Also there are numbers on each of the dialogues
    Pretty much alot of the formatting is not the same. Spaces  that break dialouge and action which are there in Story, are not converted over to Final Draft.
    Please fix this as soon as possible.
    thanks,
    Rohit

  • Having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    Hi George ,
    Is it happening with all the PDF' or any specific one?
    Could you please share the error message so that we can replicate at our end ?
    Try repairing reader  once and see if that fixes the issue.
    Launch Reader>Navigate to Help>Repair Adobe Reader Installation
    Regards
    Sukrit Dhingra

  • Renaming audio files with increasing numbers.

    I don't know if this is a Logic or a MacOS question but since it has to do with music I post it here.
    I received three Cds with audio files. Every CD starts from track number one. I want to import all that files into logic. It confuses me when I have three audio files with the same name in my audio window. I want to rename them so I can see to which CD they belong.
    I could rename all the files manually. But is there a way to rename the files with increasing numbers all at once?
    Can I do that with the file manager or automator??
    Thanks for help,
    Eddie

    Hi
    what i do is import the files in Logic.
    In the arrange window select all the different regions (i only have done this when they're on the same track).
    Select the text tool.
    click on the first track you wanna rename - a blue box will appear.
    type the preferred name with a 1 after it.
    all the regions following that region will be renamed incrementally.
    You can also do this with a single region that you have split in logic.
    Or you can split a region in logic and to rename them as individual files i press ctrl-F and ask logic to save them as "xxxfile1" - or with out the "1" i can't remember - and it saves them all incrementally.
    Hope this helps
    Rounik

  • Renaming files with alternate numbers

    I'd like to rename a large number of files with alternate numbers. For example, files 1-10 would be renamed 1,3,5,7,9,11 etc, and 2-10 would be renamed 2,4,6,8,10,12 etc.
    I'm not familiar with AppleScript but use Automator and cannot find a way to do it with actions - a script that I could run from within Automator would be wonderful. Any help would be greatly appreciated.

    There's certainly no Automator action that's going to do this directly - it's a pretty specific requirement.
    Additionally, there are some specific caveats to consider. For example, you can't rename file '2' to '3' because there's already a file '3' in the directory.
    There are two classic solutions to this: one is to work in reverse - rename file 10 -> 19, 9 -> 17, 8 -> 15, etc. so that file '3' is moved before you try to rename file 2
    The other solution is to move the files to a new directory as you rename them which ensures that no naming conflicts exist.
    Also, before anyone can show you an example, you need to be clearer on your file names. Are they really '1', '2', '3', etc., or are they "1.jpg", '2.txt', '3.png', etc. File name extensions are going to be a critical element in renaming these files correctly (e.g. you can't just rename file '2.jpg' to '3' and hope it'll work.

  • Working with random numbers and probabilities

    Hi again,
    i am working with random numbers at the moment.
    in the first step i do create a random number between 3 and 8 which is stored to a variable.
    set myVAR1 to random number from 3 to 8 as integer
    Lets assume myVAR1 is 5
    Now i want to select 5 numbers out of number pool from 1 to 8. Each number should be pickable only once.
    How would i realize that ?
    I guess i need some kind of pool, array and then select 5 out of this array, but i am not sure about the syntax.
    In best case i would like to add probabilities to those 8 numbers in the pool.
    i.e.
    1 (5%),2(5%),3(20%),4(10%),5(20%),6(10%),7(15%),8(15%)
    any help is heavily appreciated
    best regards
    fidel

    Hello fidel,
    For selecting unique numbers from given pool, try something like this.
    --SCRIPT 1
    (* select unique numbers from pool *)
    set pool to {1, 2, 3, 4, 5, 6, 7, 8} -- number pool
    set n to random number from 3 to 8 -- selection count
    return {n, random(n, pool)}
    on random(n, pool)
    set kk to {}
    repeat with i from 1 to count pool
    set end of kk to i
    end repeat
    set rr to {}
    repeat n times
    set k to kk's some integer
    set kk's item k to false
    set end of rr to pool's item k
    end repeat
    return rr
    end random
    --END OF SCRIPT 1
    For introducing selection weight of each number in the pool, you may try the below.
    --SCRIPT 2
    (* select unique numbers from pool with stochastic weights *)
    set pool to {1, 2, 3, 4, 5, 6, 7, 8} -- number pool
    set weights to {5, 5, 20, 10, 20, 10, 15, 15} -- selection weight
    set n to random number from 3 to 8 -- selection count
    return {n, random(n, pool, weights)}
    on random(n, pool, weights)
    script o
    property ww : weights
    property pp : {}
    property kk : {}
    property rr : {}
    repeat with i from 1 to count pool
    repeat my ww's item i times
    set end of my pp to pool's item i
    end repeat
    end repeat
    repeat with i from 1 to count my pp
    set end of my kk to i
    end repeat
    repeat n times
    set k to my kk's some integer
    set end of my rr to my pp's item k
    set j to 0
    set i to 1
    repeat with w in my ww
    set j to j + w
    if k > j then
    set i to j + 1
    else
    repeat with h from i to j
    set my kk's item h to false
    end repeat
    set i to 1
    exit repeat
    end if
    end repeat
    end repeat
    return my rr's contents
    end script
    tell o to run
    end random
    --END OF SCRIPT 2
    Hope this may help,
    H
    Message was edited by: Hiroto

  • Problem importing a CSV file with forward slashes in a column

    I have an Excel csv file of a product database (contains about 6500 products) that contains product codes with forward slahes such as 499/1, 499/3, 499/5.
    These are different sizes of a product and as such have different prices etc.
    When I import the file into Numbers these numbers appear as 499, 166 1/3, and 99 4/5 respectively.
    What seems to be happening is that Numbers is interpreting the forward slash (/) as a divide by command and subsequently performing a calculation on that number on import and hence totally changing the value of the cell so that it is impossible to look up the price related to a product as the product code no longer exists.
    Excel can import these files with no problems, why can't Numbers treat each cell as text and leave it alone on import.
    Is there any way round this or do I have to revert to using Excel for the import of csv files.
    Thanks
    Steve

    I know I'm a bit(!) late (a year) coming to this party, but there is a simple solution, that worked for me, enclose the field in double quotes, and add a single quote before the number:
    Instead of
    499/1,"Super Widget 3",12.34
    do
    "'499/1","Super Widget 3",12.34
    In fact the single (unclosed) quote without double-quotes works as well:
    '499/1,"Super Widget 3",12.34
    I've always found it better to enclose strings with double quotes. This works on loading the file into Mac Numbers and should work with Excel too if that helps. It opens with OpenOffice 4 on the Mac too - if you select "comma" in the "Separated by" checkbox
    I can't remember where I picked this info up....
    Hope this helps someone, albeit late.
    Andy

  • How to fill an array with random numbers

    Can anybody tell me how I can fill an array with thousand random numbers between 0 and 10000?

    import java.util.Random;
    class random
         static int[] bull(int size) {
              int[] numbers = new int[size];
              Random select = new Random();
              for(int i=0;i<numbers.length;i++) {
    harris:
    for(;;) {
    int trelos=select.nextInt(10000);
    numbers=trelos;
                        for(int j=0;j<i;j++) {
    if(trelos==numbers[j])
    continue harris;
    numbers[i]=trelos;
    break;
    return numbers;
    /*This method fills an array with numbers and there is no possibility two numbers to be the
         same*/
    /*The following method is a simpler method,but it is possible two numbers to be the same*/
    static int[] bull2(int size) {
         int[] numbers = new int[size];
    Random select = new Random();
    for(int i=0;i<numbers.length;i++)
              numbers[i]=select.nextInt(9);
              return numbers;
         public static void main(String[] args) {
    int[] nikos = random.bull(10);
    int[] nikos2 = random.bull2(10);
    for(int i=0;i<nikos.length;i++)
    System.out.println(nikos[i]);
    for(int i=0;i<nikos2.length;i++)
    System.out.println(nikos2[i]);

  • Having problems creating a zip file with Japanese language character names

    I have a bunch of files with names in Japanese characters (also Chinese, Korean, Spanish etc, but this will do for an example). The encoding is Unicode.
    I wish to be able to put them in a zip file, then extract them again using any old zip tool (WinZip,PKZip,7-Zip etc)
    Trouble is, every time I do it, the files inside the zipfile end up with garbage character names. The contents of the files are fine, though.
    I'm aware that there used to be a bug in the java.util.zip.* classes regarding character encodings (http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=5bd4fe01ad8a7b4ec89afef5005da?bug_id=4244499) but as far as I can see it's supposed to have been fixed I have also tried the ZipOutputStream class from apache which allows you to set the encoding manually - no luck there either (just many different varieties of garbage characters)
    Test code below. What am I missing here?
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    public class ZipTest {
    static String uniqueFileName = "&#35199;&#12288;&#32020;.txt";
    public static void main(String[] args) {
    try {
    standardZip();
    apacheZip();
    } catch (IOException fe) {
    System.out.println("problem in file - exception " + fe.getMessage());
    public static void apacheZip() throws IOException {
    String encoding = "";
    File inputFile = new File(uniqueFileName);
    FileReader reader = new FileReader(inputFile);
    encoding = reader.getEncoding();
    System.out.println("Using Apache - Encoding = " + encoding);
    File zipFile = new File("apacheZip.zip");
    org.apache.tools.zip.ZipOutputStream zipOutputStream = new org.apache.tools.zip.ZipOutputStream(
    zipFile);
    zipOutputStream.setEncoding(encoding);
    org.apache.tools.zip.ZipEntry zipEntry = new org.apache.tools.zip.ZipEntry(uniqueFileName);
    zipEntry.setSize(inputFile.length());
    zipEntry.setTime(inputFile.lastModified());
    zipOutputStream.putNextEntry(zipEntry);
    int c = 0;
    while (c >= 0) {
    c = reader.read();
    if (c >= 0) {
    zipOutputStream.write(c);
    zipOutputStream.closeEntry();
    zipOutputStream.finish();
    public static void standardZip() throws IOException {
    String encoding = "";
    File inputFile = new File(uniqueFileName);
    FileReader reader = new FileReader(inputFile);
    encoding = reader.getEncoding();
    System.out.println("Using Java IO - Encoding = " + encoding);
    File zipFile = new File("standardZip.zip");
    FileOutputStream zipOut = new FileOutputStream(zipFile);
    java.util.zip.ZipOutputStream zipOutputStream = new java.util.zip.ZipOutputStream(zipOut);
    java.util.zip.ZipEntry zipEntry = new java.util.zip.ZipEntry(uniqueFileName);
    zipEntry.setSize(inputFile.length());
    zipEntry.setTime(inputFile.lastModified());
    zipOutputStream.putNextEntry(zipEntry);
    int c = 0;
    while (c >= 0) {
    c = reader.read();
    if (c >= 0) {
    zipOutputStream.write(c);
    zipOutputStream.closeEntry();
    zipOutputStream.finish();

    Emma_Baillie wrote:
    I have a bunch of files with names in Japanese characters (also Chinese, Korean, Spanish etc, but this will do for an example). The encoding is Unicode.
    I wish to be able to put them in a zip file, then extract them again using any old zip tool (WinZip,PKZip,7-Zip etc)
    Trouble is, every time I do it, the files inside the zipfile end up with garbage character names. The contents of the files are fine, though.This is becuase zip tool doesn't support unicode for zip entries. For example WinZip prior to 11.2 does not support Unicode characters in filenames. You need to look for the simillar information for other tools. You can find more on tools on their website.

  • Problem saving annotated PDF files with windows reader app

    It has happened to more than one of my files. After I read it, and jotted some notes on it, when I was trying to save, it tells me I couldn't. At first, l thought it was a problem of my file. However, it has happened to every file I tried. When I opened
    the file with another PDF app, it opens and saves fine.
     Is there anything I am missing that causes the problem?

    Hi,
    I just made a test using Windows Reader, it works fine without problem. For your problem, I doubt there is a problem with this app and you can try to reinstall this Reader app trough Windows Store.
    On the other hand, you can access to the link below to download the pdf file to make a test. I already made a test using this pdf file on my system, Windows 8.1 Pro. Reader app works fine:
    http://research.microsoft.com/pubs/238337/AutoCharge-TR.pdf
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Hidden folders and files with random character filenames

    You could try media info to see if that tells you any different - be sure to decline the stupid addons included
    https://mediaarea.net/en/MediaInfo

    Recently I noticed several hidden folders with random character names and each of those folders has 5 files in them with randomly named files. These are tiff, png, bmp, and docx files. I copied the folder to virtual machine removed from the network to inspect them, but they can not be opened as it says files appears damaged or corrupt. They appear to be benign as I ran two full system virus scans (including malwarebytes), but really bothers me how they got there in the first place. The owner says local administrators. They were found on the root of the C: drive and in documents, pictures, music, and video of the user profile. I attached a picture to help understand what they look. They are different than other examples I have seen when I attempted to google my answer. Thanks in advance!
    This topic first appeared in the Spiceworks Community

  • Problems syncing Apple Lossless Files with iphone 3.0 and 3.1.

    I recently started having problems with syncing apple lossless files with my iPhone 3G. They were recording I made using Logic Pro and the same as have been working with no problem since I got my iPhone last year. Although the songs would play and indicate the correct total time in iTune, on the iPhone they would indicate a total time of over 2 hours even though they were 2-3 minute long. The same files converted to mp3 did not have this problem. Since updating to iTunes 9 and 3.1 on the iPhone, the problem is worse. The Apple Lossless format files do not show up on the iPhone at all even though they are fine in iTunes. mp3 format do not have this problem.
    Anyone else having the same issues?

    Hi Allen,
    I would like to thank you very much for your help with Forte 3.0 and WTK 1.0.1 beta.
    Thank you for the pointing me to the ForteJ2MEGuide.pdf file. It is very useful document.
    However, even following it I did not succeeded in accomplishing my task.
    I was able to follow the instructions and create, compile and run the Hello midlet which
    was generated by the IDE. My previous problem related to the fact that I did not create
    project and midlet suite for the midlet. After doing all of that the generated midlet worked. However, it was not what I wanted.
    First, the instructions in the guide only described how to generate new midlet. I tried
    to add the existing midlet to the current project. Unfortunately, the IDE always picked
    up the generated template, not my code.
    Second, when the generated midlet started to work, it was difficult to debug it. I set
    up the breakpoint, but the IDE did not stop at it. I think the reason is the compiler
    did not have debugging flag set up. Do you know where it is possible to set it up?
    So, at the end I still cannot accomplish very simple task which should not be very
    difficult at all:
    1. Use my own code to create a midlet.
    2. Compile and execute the midlet and see how it runs in emulator.
    3. See step-by-step execution of every line of my code and the value
    of every variable in the code.
    Regards,
    Jacob Nikom

  • Problems opening & resaving NEF files with CS3/CS2

    I seem to be having problems sending my NEF files to Photoshop from Aperture. This started happening just today & I'm not sure what to do.
    What happens is that when I open a NEF file in external editor, instead of just opening up as a psd file in CS3 or CS2 directly like it used to do, it now opens Adobe Raw instead which means that I am unable to resave back into my Aperture Library. Is there anyone who has experienced this as well? Any suggetions as to the cause and a solution? I tried checking preferences for both Aperture as well as Photoshop but nothing seems to work.
    The only thing I can think of is having just updated Adobe Raw to the latest version, 4.3 I think. Other than that Aperture did start up about a week ago & declared my library corrupt & proceeded to rebuild my library. Other than that it was behaving normally until today. Its really irritating & counter productive to be unable to resave my edits in Aperture.
    Any help or suggestions will be very welcome indeed. Thanks in advance.

    Thanks for the tip Eduardo, but I checked the preferences and they seem to be correct.
    It seems that only images in certain projects were affected. Could be the ones that Aperture rebuilt earlier. I guess I may have to try exporting the raw files from the affected projects, then deleting and reimporting the projects again. I did try to rebuild the thumbnails but it doesn't seem to help.
    Does anyone have any other suggestions for me to try before I do this?

  • Problems uploading a text file with line feed characters from Windows

    Hi,
    I am using the FM GUI_UPLOAD to load a text file in which at the end of each line there is a line feed character. When I upload the file, the FM interprets the entire file as ONE record; it does not recognize the line feed character at the end of each file line. I am using the parameter in the FM "HAS_FIELD_SEPARATOR" and it does not do anything to remidiate this issue.
    The funny thing is that  WS_upload works like a charm and it separates every line in the text file according to the line feed character at the end of each file line.
    Why a FM that is obsolete would work better and with  less effort than the new one? We are on 4.6c and will go to ECC6.0 May 2009.
    Can anybody recommenced a way to process this type of file using GUI_upload?
    The file to process is downloaded from a bank Website into a Windows PC. Sending the file to Unix first is not an option.
    Thanks,
    Pierre Martinez
    Edited by: Pierre Martinez on Aug 15, 2008 1:09 AM

    Hi,
    I have done that and Notepad does NOT interpret the line feed character. The file looks all messed up. Notepad does NOT split the data into records. The Hex character at the end of each file line is 0A.
    The user will download the file into a Windows desktop from the bank's website and from there an ABAP  program needs to read it and parse it. But the ABAP  program can not even catch the entire file with gui_upload. WS_upload can catch it with no issues.
    I tried catching the file into an internal table of data type string using GUI_upload, but it only catches two bytes of the file and nothing else.
    I will try catching the file in some other type of data type for the internal table in gui_upload.
    Once I catch it, I can split the file by the line feed character. I need to catch it  first, but "my glove" is not big enough. Defining the internal table for the gui_upload as character is a guessing game since I really do not know how big the text file is since GUI_upload will put it in a one record.
    Thanks.

Maybe you are looking for

  • How do I use my own music for a ringtone?

    I just got the iphone 4s. All my music has been loaded on to the iphone. How do use that music to make pick out my own songs? Or do i have to pay for them again in the ringtone store? thanks

  • Satellite M70-131: Is a PA3396E-1ACA AC-adapter compatible

    Hi! My brand new M70-131 , model PSM70E-01500QG3 came with AC Adapter with Part Number : PA3396E-1ACA. I read on the support site, the AC Adapter should be: PA3468E-1AC3 This AC Adapter works fine and the battery gets charged ok. I just want to ask i

  • Need help on Reader

    Hi, I've created a pdf file using adobe acrobat 9.4.3 pro and enabled extend features in adobe reader in order to allow my users to save data that they enter into the form.  I have tried to use this pdf on two different computers (both have adobe rea

  • ITunes icon does not appear correctly on my PC desktop after upgrading to 10

    I just upgraded my iTunes to version 10 agains my better judgment and now the icon on my PC desktop is not the real iTunes icon but just a generic icon.  Could anyone tell me why?  Thanks.

  • Delaying link open after click

    As above - I'm making a simple page with clickable images as links. I used some fade/appear behaviors on them. I wanted to achieve effect that after I click on image it will first quickly fade to 0% and after that opens related page. Here is the addr