How to convert binary string to ascii
Hi,
See i have a string like this,
String str = "10011100110001011001110011000101";
Now i want to find exact ascii value of the binary string.
Thanks in advance.
First want to convert these bits to corresponding
characters and then have to find ascii of the same.... corresponding to what? I think converting these "bits" to the corresponding chars is the whole story. But what about the original format?
Guessing mode on ... does this help?
String input = "...";
StringBuffer result = new StringBuffer();
for (int i = 0;i < input.length();i += 8) {
result.append((char) Integer.parseInt(input.substring(i, i + 8), 2));
System.out.println(result);
Similar Messages
-
How to convert character string into ascii format correctly
dear all
I'm using encryption technique in my application(oracle formas 6i). character stream convert to the ascii format and add some numeric value and again convert to the character format
>>>>
here I'm using ASCII and CHR functions.
>>>>
.net program also using same algorithm to encrypt this password.....finally both the character strings are not equel.(This happens if the character string's ascii value greater than 127. otherwise both are equel).
pls give me a solution for this
thanks and regards
buddhikehir dear
do u want to encrypt & dcrypt your password.which version of oracle you are using
first store these procedure in Oracle Databases: dbms_obfuscation_toolkit, dbms_crypto, Transparent Data Encryption
now u can use these procedure to encrypt & dcrypt your password
if you any query about those procedures you can ask me
best regard
amk -
How to convert Binary to String?
Hi,
How to convert Binary to String? Thank!Never ceases to amaze me how many people cannot
accept any form of criticism whatsoever. How dothey
get through the normal day? Do they pick fightswith
everyone who says anything to them they don'tlike?
Was this for me????Who are you calling a psycho?? -
How to Convert Binary Data in Binary File
hi,
my telecom client puts a binary file which is asn.1 encoded with BER.
how to handle binary data in java.
how to convert binary to hexa to ascii format
how to convert binary to octet to ascii format
please help me in this.
regards,
s.mohamed asifYou don't need to convert the data.
Only you can do is print it in that formats, like it:
public static String byteArrayToHex(byte[] b) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++)
sb.append(Integer.toHexString(b&255) + " ");
return sb.toString();
take a look at this
http://java.sun.com/docs/books/tutorial/essential/io/ -
How to convert a string value to date
Dear All,
I am new to powershell script, i was trying to store a Ad user password set date to a variable add, add a number of days to get the expire date.
but when i try to convert the variable to date value, I am getting the error as below.
Please help me......
PS C:\script> $passwordSetDate = (get-aduser user1 -properties * | select PasswordLastSet)
PS C:\script> $passwordSetDate
PasswordLastSet
7/15/2014 8:17:24 PM
PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
Cannot find an overload for "ParseExact" and the argument count: "3".
At line:1 char:1
+ $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)Dear All,
I am new to powershell script, i was trying to store a Ad user password set date to a variable add, add a number of days to get the expire date.
but when i try to convert the variable to date value, I am getting the error as below.
Please help me......
PS C:\script> $passwordSetDate = (get-aduser user1 -properties * | select PasswordLastSet)
PS C:\script> $passwordSetDate
PasswordLastSet
7/15/2014 8:17:24 PM
PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
Cannot find an overload for "ParseExact" and the argument count: "3".
At line:1 char:1
+ $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
PS C:\script> $a = [datetime]::ParseExact($passwordSetDate,"MM/dd/yyyy HH:MM:SS", $null)
In your post you ask how to convert a string value to a date. The value returned from the Get-AdUser is already a date. It does not need to be converted.
Bill has sshown one way to convert a date to a string and there are other methods. You need to clarify your question.
If you are really trying ot convert strings to dates then you can start with this:
[datetime]'01/21/1965 13:33:23'
Most date strings aer autodetected by the class.
¯\_(ツ)_/¯ -
How to convert a String("yyyy-mm-dd") to the same but in Date format ?
Hi,
can anyone plz tell me how to convert a String to a date format.I'm using MSACCESS database.I want to store this string in the database.So i need to convert it to a date format since the table is designed such a way with date/time type for date field.I used SimpleDateFormat ,but i can't able to convert.The code is given below:
coding:
public String dateconvertion(String strDate)
try
SimpleDateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdfSource.parse(strDate);
SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd ");
strDate = sdfDestination.format(date);
catch(ParseException pe)
System.out.println("Parse Exception : " + pe);
return(strDate);
}i used prepared statement even now i am getting error like this.....
i have included the prepared statement package also...
my coding:
ResultSet rsdatetemp = null;
PreparedStatement ps = null;
String query ="select distinct itemcode from sales where bill date between ? and ?";
ps = precon.prepareStatement(query);
ps.setDate(1,d1);//d1 and d2 are in date format
ps.setDate(2,d2);
rsdatetemp = ps.executeQuery();
error :
symbol : method setDate(int,java.util.Date)
location: interface java.sql.PreparedStatement
ps.setDate(1,d1);
symbol : method setDate(int,java.util.Date)
location: interface java.sql.PreparedStatement
ps.setDate(2,d2); -
How to convert a String to an Icon
Hello,
I'm trying to figure out how to convert a String (specifically one letter) to an Icon for a JTree. The program I am working on uses .png files for the icons at the moment, with each .png being a single uppercase letter. However, recent discussion has us wanting to change to something more dynamic, since we anticipate needing new letters in the near future.
My task is to modify the current codebase so that the Icons used to identify nodes in the tree are created from a Font within code, rather than reading in .png files. I have done some experimenting with creating a Label with just that String, setting the font and trying to extract the image using calls like createImage(int width, int height) and so on, but so far to no avail.
If I could figure out how to at least convert the String to an image, I could probably make it work (since I can play around with creating an ImageIcon with that image). Thanks in advance for any help.
AllanHere is some quick and dirty code:
import java.awt.*;
import javax.swing.*;
public class BasicIcon implements Icon {
private String text;
public BasicIcon(String text) {
this.text = text;
public int getIconWidth() {
return 16;
public int getIconHeight() {
return 16;
public void paintIcon(Component c, Graphics g, int x, int y) {
Color old = g.getColor();
g.setColor(c.getForeground());
g.drawString(text, x, y+13);
g.setColor(old);
public static void main(String[] args) {
JPanel cp = new JPanel();
for (char ch = 'A'; ch < 'F'; ++ch) {
cp.add(new JButton("letter " + ch, new BasicIcon(String.valueOf(ch))));
JFrame f = new JFrame("BasicIcon");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setContentPane(cp);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}One thing that could be improved is the vertical positioning of the letter in the Icon.
The x,y values passed into paintIcon are the upper-left hand corner of the icon,
but the y value needed by drawString is the position of the String's baseline.
To do it right, use one of Font's getLineMetrics methods and play around with ascent. -
How to convert a string from upper case to lower case in FOX formula
Hi Experts,
How to convert a string from upper case to lower case in FOX formula?
Thanks,
Cheers!!!
PANKAJThe last result.append( c ) should be:
result.append( Character.toLowerCase(c) ); -
How to convert a string from lower case to upper case withour using transla
Hi all,
how to convert a string from lower case to upper case withour using translate,
Thanks in Advance,
ReddyRefer to this related thread
Re: hi guys this very urgent please help -
How to Convert binary file to s-records
Hi all,
can anybody help how to convert binary ".bin" files to s-record ".s" files
any idea or code snippets are very appreciated
best regards,
gebiThere is a ready-made converter: "BINARY to Motorola S-Record Conveter Utility" or BIN2MOT.
http://www.keil.com/download/docs/bin2mot.zip.asp
Other references:
http://www.cs.net/lucid/moto.htm
http://www.amelek.gda.pl/avr/uisp/srecord.htm
http://www.seattlerobotics.org/encoder/jun99/dougl.html
http://semmix.pl/mipc/specyf/filehex/mhexu.htm
http://pmon.groupbsd.org/Info/srec.htm -
How to convert a String to an array
Can somebody tell me how to convert a String to an array
ronisto wrote:
Can somebody tell me how to convert a String to an arrayI assume you mean to convert it into an array of the individual characters that comprise the String.
Can you not simply look at the API documentation? Nothing in the String API jumps out at you?
http://java.sun.com/javase/6/docs/api/index.html -
How to convert binary file to a particular format?
Hi,
I am having a requirement. I have in database various kinds of files stored as binary format. Its a sybase database. Now the files can be .pdf, or .doc also. But they are stored in binary format.
I need to read the file from database.
Now I can use jdbc to read the particular column value which contains the file in binary format.
But tricky part is how to convert the binary file entry in a proper respective file format? So I have another column which basically has the value to tell the type of file. So I have ".doc" or ".pdf" as each entry of file...
So please help me how can we do this using Java?
THanksHi,
I am having a requirement. I have in database various
kinds of files stored as binary format. Its a sybase
database. Now the files can be .pdf, or .doc also.
But they are stored in binary format.
I need to read the file from database.
Now I can use jdbc to read the particular column
value which contains the file in binary format.
But tricky part is how to convert the binary file
entry in a proper respective file format? So I have
another column which basically has the value to tell
the type of file. So I have ".doc" or ".pdf" as each
entry of file...
So please help me how can we do this using Java?
THanks -
XML: How to convert xml string into Node/Document
I have a string in xml form.
<name>
<first/>
<second/>
</name>
I want to convert this string into DOM Node or Document.
How can I do this?
Any help or pointer?
TIA
SachinTry this :
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new org.xml.sax.InputSource(new StringReader(strXml)));Hope this helps. -
Help with how to convert a string to a number ??
Hi All,
I am having problem converting a string to number.
Looks like my to_number function is not working.
Help is very much appreciated.
My query is below, and I know my problem is in my inner query.
I am getting the following error:
what am I doing wrong ? and how should I fix it.
If there is a better approach, please share it.
ORA-01722: invalid number
01722. 00000 - "invalid number"
*Cause:
*Action:
SELECT
A.OBJECT_NAME,
A.TIMESTAMP,
A.SESSION_ID,
A.REQUISITION_ID,
TO_DATE(CUT(RR_PACE_FUNCTIONS.NAME(A.REQUISITION_ID),3,'.'),'YYYYMMDD') CSD,
SUBSTR(SUBSTR(RR_PACE_FUNCTIONS.DESCRIPTION(A.REQUISITION_ID),9),1,30) COURSE_ID,
A.WEEK_GROUP,
A.APTITUDE_AREA,
SUM(NVL(GTEP_ASGN,0)) GTEP_ASGN,
SUM(NVL(AI_ASGN,0)) AI_ASGN,
SUM(NVL(GTEP_ASGN,0) + NVL(AI_ASGN,0) ) BMT_ASGN
FROM
(SELECT OBJECT_NAME,
SESSION_ID,
TIMESTAMP,
TO_NUMBER(FIELD1) REQUISITION_ID, -- I believe here is the problem
TO_NUMBER(FIELD2) WEEK_GROUP, -- here as well
SUBSTR(FIELD3,1,80) APTITUDE_AREA,
TO_NUMBER(FIELD4) GTEP_ASGN, -- here
TO_NUMBER(FIELD5) AI_ASGN -- here
FROM RR_REPORT_QUEUES
) A
GROUP BY OBJECT_NAME,
TIMESTAMP,
SESSION_ID,
WEEK_GROUP,
APTITUDE_AREA,
REQUISITION_ID ;Many Thanks,Are you sure Field1, Field2, Field4 and Field5 contain a number information in all rows?
If there is a non numeric String in your Field<x> columns in any row the error will occor. -
[Oracle 8i] How to convert a string (time stamp) into a date?
I'm having difficulty figuring out how to convert a time stamp string into a date (or possibly a number).
The time stamp is 20 positions, character (NOT NULL, CHAR(20))
in the format: YYYYMMDDHHMMSSUUUUUU
where Y = Year, M = Month, D = Day, M = Minutes, S = Seconds, and U = Microseconds
The reason I want to convert this is so that I can compare one time stamp to another (i.e. I want to be able to find the MIN(timestamp), MAX(timestamp), and do inequality comparisons).
Is this at all possible?
Thanks in advance for help on this!Hi,
As Damorgan said, if all you want to do is find which is the earliest or latest, then you can just compare the strings: they happen to be in a format where that works.
If you need to do other things, such as compare them to today's date, or see the difference between two of your rows in days, then you have to convert them to DATEs. (There's no point in converting them to NUMBERs).
A new data type, TIMESTAMP, which handles fractions of a second, was introduced in Oracle 9.
Since you're using Oracle 8 (according to your subject line), you either have to
(1) ignore the microseconds, or
(2) use a separate NUMBER column for the microseconds.
Either way, use TO_DATE to convert the first 14 characters to a DATE:
TO_DATE ( SUBSTR (txt, 1, 14)
, 'YYYYMMDDHH24MISS'
)where txt is your CHAR column.
To convert the microseconds to a number (between 0 and 999999):
TO_NUMBER (SUBSTR (txt, 15))
Maybe you are looking for
-
Hi Gurus, One of my essbase app has stopped. I tried to start it from the EAS console and it does not start. It give a message, the following application did not start. It gives ERROR 1002097 Unable to load database Any suggestions? Thanks
-
Breaking more than one loop in single command
Hi, I'm wondering if it is possible to break out of a two loop from the nested loop. i.e while(condition) { while(condition2) { break; //but I'm I want to break both loops }for now I have something like this boolean something=false; while (con
-
N97 can send but not receive Yahoo emails. Secure ...
Hi all, I promise i have looked through the other answers on here but not tell me precisely what to do. 1. Went to Yahoo and activated POP & Forwarding 2. Double checked Incoming and Outgoing servers i.e. pop.mail.yahoo.co.uk SSL Port 995 and smtp
-
How to add a video file directly as a music video file?
When I add a new video file its always taken as a movie file and i have to change the video kind from movie to music video.Is there any way to assign the kind as music video to more than one file at once?
-
Urgent! 500 internal server error
Good afternoon, When i run other interactive forms , it show successfully on the adobe forms however, when i run my project , it show : <b>500 Internal Server Error Failed to process request. Please contact your system administrator. Error Summary