0

Java project. I have a big string coming from command line like :

 Total 5.89452: not packed
  0|PE Header|0|1024|3.04974: not packed
  1|Section(0)['.text']|1024|420352|5.83462: not packed
  2|Section(1)['.rdata']|421376|78336|4.84439: not packed
  3|Section(2)['.data']|499712|3584|2.61044: not packed
  4|Section(3)['.pdata']|503296|12800|5.54411: not packed
  5|Section(4)['.rsrc']|516096|1536|3.90572: not packed
  6|Section(5)['.reloc']|517632|2560|4.89783: not packed
  7|Overlay|520192|9088|7.37885: packed

And i have to separate strings ,then put into object fileds:

public class DieEntropy {
    private String name;
    private String bias;
    private String size; 
    private String entropy; 
    private String status; 
}

where:

name = Section(0)['.text']
bias = 1024
size = 420352
entropy = 5.83462:
status = not packed

and other the same way.

Olivier
  • 13,283
  • 1
  • 8
  • 24
clutch 77
  • 1
  • 2
  • Does this answer your question? [How to split a string in Java](https://stackoverflow.com/questions/3481828/how-to-split-a-string-in-java) – OH GOD SPIDERS Jul 29 '21 at 12:17
  • You might do `line.split("\\||:")` for this one as the colon is also a delimiter – g00se Jul 29 '21 at 13:51
  • I splited big string ,but i can't find algorithm to put right string into right position in object , this was my trouble at the first place – clutch 77 Jul 29 '21 at 19:58

1 Answers1

0

Having this class:

public class DieEntropy {
    private String name;
    private String bias;
    private String size; 
    private String entropy; 
    private String status; 
}

You are not allowed to modify the values of the fields from outside because they are private (except the rare case that the class is a nested class).

Grim
  • 1,938
  • 10
  • 56
  • 123