Loosing prefixed zeros in byte to hexa conversion
hi,
i am using:
Integer.toHexString(byte & 0xff) to convert from byte to hexadecimal.
if the byte has zeros prefixed , they are being lost.
ie. if the byte is 02 i get only 2. but i need the 02 as a whole.
how can i correct this.
10q.
Don't create new threads with the same question:
http://forum.java.sun.com/thread.jspa?threadID=601733
Similar Messages
-
How to add prefix zero to all matnr fields in itab
Hi,
I ve a internal table with following fields
Matnr bwkey
6 678
67 rty
678 78k
How to add prefix zero to all tha matnr fields.
like
matnr bwkey
00000000000000006 678
00000000000000067 rty
00000000000000678 78k
Thanks in advanceHi,
commonly used conversion routine is ALPHA.
It is conversion used to insert leading zero for document number.
For example, in sales order (VBAK-VBELN length 10),
when we key in order no, for example we key in '4302',
conversion routine input will automatically add leading zero,
so it will become '0000004302', this is real value stored in table VBAK.
On conversion routine output, it will delete leading zero
function CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
Ex:
data: lv_c(10) type c value '123'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = lv_c
importing
output = lv_c.
write:/ lv_c.
Regards. -
Hi All,
I have an itab with following data.
column
000001
000002
000003
000004
000005
I download this file using FM 'GUI_DOWNLOAD' as an .xls file.
but when i open this file in excel, the column data dosent contain prefixed zeros. i want the data to be downloaded with prefixed zeros.
Thank You All,
sal.hi,
Download in 'DBF fomrat ..'
CALL FUNCTION 'GUI_DOWNLOAD'*
filetype = 'ASC' "----
> change file type to 'DBF'
or
you have to download the value in character format with preceding single qoute .
for example -
if you are downloading 000010 means, assign that value as '000010.
So that, excel can treat it as character & the zeros will be retained.
either after download the excel do the change of properties of excel.
or
by giving itab-column = '00001. it will solve the problem but that symbol " ' " also appears.
regards
rahul -
Hi all,
I'm trying to read in an image and get an int / hex array out of it. Basically, I want to get an array that would look like what you see if you open an image in a hex editor. I have no problems getting a byte array using..
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ImageIO.write( bufferedImage, "jpg", stream );
bytes = stream.toByteArray();
But, it's weird, it's not really what I want. The result is not the same as what I see if I drop the same image into a hex editor and look at the bytes. Not sure if I need to convert the bytes to hex or what. Any help would be much appreciated.hmm.. can you explain a bit?.. let's say I do...
BufferedImage srcImage = ImageIO.read( new File( pathIn ));
ByteArrayOutputStream streamIn = new ByteArrayOutputStream();
ImageIO.write( srcImage , "jpg", streamIn );
byte[] bytes = stream.toByteArray();
ByteArrayInputStream streamOut = new ByteArrayInputStream( bytes );
BufferedImage writeImage = ImageIO.read( streamOut );
ImageIO.write( writeImage, "jpg", new File( pathOut ));Looks a little odd out of context, I know. But, basically, the resulting image is different than the original image. I assume, maybe, there is some sort of compression going on. But i don't really know. Should I be decoding / encoding in specific formats to get the resulting image to be /exactly/ the same as the source?
thanks -
Answers report-download as Excel loose trailing zeroes
Hi!
When I download Answers report to Excle (Word) I loose trailing zeroes.
1.2500 -> 1.25Trailing zeroes are important and I'd like that format remain as it is in OBI in all downloading types (Excel, Word etc).
When I export to PDF (run through Oracle BI publisher) trailing zeroes are correct.
Any help please.
My config, OBI on Windows 2003 32 bit:
Product Information
Oracle Business Intelligence Product Version 10.1.3.4 (Build 080726.1900)
Physical Presentation Catalog Path \\?\C:\OracleBIData\web\catalog\teb\root
Oracle BI Server Data Source AnalyticsWeb
Available Paging Memory (MB) 5176
Available Virtual Address Space (MB) 1833Hi,
here are mine data as requested ...
The only three formating columns are Cash up KN, Cash up EUR i Cash up EUR/KN.
Column that has problem has no "mso" like formating at all, only two decimal number format, defined in classic way in OBI.
Generated Excel file from OBI:http://sites.google.com/site/vadasovi/icon_holders-1/BAZA.xls
How it is opened in Excel 2003:http://sites.google.com/site/vadasovi/_/rsrc/1318338523563/Home/temp/2007.PNG , look column in red.
Same file in Excel 2010 (other mashine then 2003:http://sites.google.com/site/vadasovi/_/rsrc/1318338543353/Home/temp/2010.png
Both client are Win XP SP3 with Croatian locale (same one in detail).
Rg,
Damir -
Prefix zero to a decimal number
Hi All,
I need to send a value to third party system. The value is a decimal number but before sending it i need to prefix zero.
Eg: 1.25---> 00000000001.25
The Functiom module CONVERSION_EXIT_ALPHA_INPUT works only for integers.
Can you please suggest a function module which wil satisfy my requirement.
Thanks
RohitUse a For loop to index into the array, then use the Not Equal To Zero comparison to convert it to true/false. Then Index out of the For and use the Bool Array to Int from the boolean pallete.
Here is an example in 8.2
Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
Attachments:
Convert Bit Array to Int.vi 8 KB -
DECIMAL = HEX CONVERSION PACKAGE 생성 SCRIPT
제품 : SQL*PLUS
작성날짜 : 2002-04-12
DECIMAL <=> HEX CONVERSION PACKAGE 생성 SCRIPT
==============================================
Purpose
Oracle내에서는 여러가지 값을 HEX 값으로 보여주는 경우가 있다.
이런 경우 DB내에서 decimal 값으로 변환하기 위한 방법을 알아보자.
Explanation
다음은 decimal <=> hexa 의 conversion을 위한 package 생성문으로서
system user로 수행하여 사용한다.
create or replace package support as
function dectohex (a number) return varchar2;
pragma restrict_references
(dectohex, WNDS, WNPS, RNDS, RNPS);
function hextodec (a varchar2) return number;
pragma restrict_references
(hextodec, WNDS, WNPS, RNDS, RNPS);
end support;
create or replace package body support as
FUNCTION hextodec(a IN VARCHAR2) RETURN NUMBER IS
x NUMBER := 0;
y NUMBER;
z VARCHAR2(1);
BEGIN
IF length(a) > 8 THEN
RAISE invalid_number;
END IF;
FOR i IN 1..length(a) LOOP
z := upper(substr(a,i,1));
IF z = 'A' THEN
y := 10;
ELSIF z = 'B' THEN
y := 11;
ELSIF z = 'C' THEN
y := 12;
ELSIF z = 'D' THEN
y := 13;
ELSIF z = 'E' THEN
y := 14;
ELSIF z = 'F' THEN
y := 15;
ELSE
y := to_number(z,9);
END IF;
x := x * 16;
x := x + y;
END LOOP;
RETURN x;
END hextodec;
FUNCTION dectohex(a IN NUMBER) RETURN VARCHAR2 IS
x VARCHAR2(8) := '';
y VARCHAR2(1);
z NUMBER;
w NUMBER;
BEGIN
IF a > power(2,32) OR a < 0 THEN
RAISE invalid_number;
END IF;
w := a;
WHILE w > 0 LOOP
z := w mod 16;
IF z = 10 THEN
y := 'A';
ELSIF z = 11 THEN
y := 'B';
ELSIF z = 12 THEN
y := 'C';
ELSIF z = 13 THEN
y := 'D';
ELSIF z = 14 THEN
y := 'E';
ELSIF z = 15 THEN
y := 'F';
ELSE
y := to_char(z);
END IF;
w := trunc(w / 16);
x := concat(y,x);
END LOOP;
RETURN x;
END dectohex;
END support;
drop public synonym support;
create public synonym support for system.support;
grant execute on support to public;FYI: The new xf86-video-intel (2.9) has just been released:
http://article.gmane.org/gmane.comp.fre … xorg/40733
According to the release announcement, the new driver fixes the backlight issue with KMS:
* Add support for BACKLIGHT property when using kernel modesetting
(KMS). This allows backlight adjustment with programs such as
"xbacklight -set <percentage>" or "xrandr --set BACKLIGHT <value>". -
Hi,
How can i convert character into hex string , for example if i have the data as "testing data", how can i get the hex coded output? Ive tried out using first string to number vi and thennumber to hex conversion vi but i get the answer as 0, can u help me in this?
In short my data is " testing1234okokok" , i want a hex coded output which would be something as "AD87BA......."
Please help
From SubhashWhat coercion dots? There are no coercion dots even without the loop:
Message Edited by smercurio_fc on 02-13-2008 03:12 PM
Attachments:
Example_VI.png 1 KB -
Interger to hex conversion ???
Hi
Is there a easy way to make interger (unsigned 32 bit ) to HEX
conversion ??Kristian,
It depends on what you want to do with the hex conversion. To view a
number in hex in a control, right click on the control, select Format &
Precision. As long as the format is set to numeric, you can select
between decimal, hex, octal and binary from the other drop-down list.
If you want to change an unsigned 32-bit number to a hex value to be
written to a file, you can use the String->Format Into String VI. Wire
your U32 into input 1, and set the format string to %4x (which will show
a 4 digit hex value). The output will be a string which contains the
hex value.
Hope that helped.
Mark
In article <[email protected]>,
[email protected] wrote:
>
>
> Hi
>
> Is there a easy way to make interger (unsigned 32 bit ) to H
EX
> conversion ??
>
Sent via Deja.com http://www.deja.com/
Before you buy. -
Problem with EPC URI to Hex conversion
Hi Forum,
I am getting strange EPC URI to hex conversion result in tx:/ain/http_test . Could you please confirm if this result is not expected.
1.URI : urn:autoid:tag:sgtin-96:3.0066800.054321.70
hex is : 30740413C00000D431000000
2.URI: URN:AUTOID:TAG:SGTIN-96:3.0066800.054321.71
hex is: 30740413C00000D431000000
thus is both case HEX is same!!!
i am using EPC_1.24 as active EPC version.
could you please suggest some round about way.
thanks in advance,
regards,
Ashithi,
i think problem is with EPC_1.24. i changed to
EPC_1.27
and it works fine.
regards,
Ashit -
Prefix zero to alphanumeric characters
Hi All,
Can anyone suggest me any Function module is there to prefix zero to an alphanumeric charcter. I have been trying conversion_exit_alpha_input FM for this purpose but it works fine only for numerics. plaese let me know any FM exists for alphanumeric characters which serves the purpose.
Thanks in Advance
RijishHi,
You can use the below code.
report abc.
data: v_size1(2) type n,
v_size2(2) type n.
constants: c_zeroes(18) type c value '000000000000000000'.
parameters: p1(18) type c.
shift p1 left deleting leading space.
v_size1 = strlen( p1 ).
if v_size1 lt 18.
v_size2 = 18 - v_size1.
shift p1 right deleting trailing space.
p1+0(v_size2) = c_zeroes.
endif.
write p1.
Also, note that the v_size2 is to be calculated as per your requirement. -
Hi ALL,
We have one masterdata info object length is 15 char, our source field is 40 char length, the data is getting from source is
0000000000000000001234567890, the issue is we are getting all Zero in our BI with that master data.
I want to trancate the prefix zeros load only remaining values.
I want to write a code in master data transformation, please provider the code for this issue.
Many thanks,
Manu.Hi Manu,
There are many ways
RESULT = SOURCE_FIELDS-0Material.
shift RESULT left deleting leading ' 0' .
Rgds
SVU123
Edited by: svu123 on Aug 9, 2010 11:33 AM -
Help needed in understanding conversion alghorithm from byte to hex
Hi, I'm studying the following code:
public static char[] byteToHex(byte[] data) {
char[] retValue = new char[data.length * 2];
int value = 0;
int highIndex = 0;
int lowIndex = 0;
for (int i = 0; i < retValue.length; i++) {
value = (data[i] + 256) % 256;
highIndex = value >> 4;
lowIndex = value & 0x0f;
retValue[i * 2 + 0] = hexTable[highIndex];
retValue[i * 2 + 1] = hexTable[lowIndex];
return retValue;
}There are few things (the most important) which I don't understand about the above code.
I understood that what's returned has got double size related to what's passed in because a char takes 16 bits while a byte takes 8.
1) I don't understand why each byte must be first added 256 and then % with 256 (returning the same value - Is this to eliminate negative values?)
2) I do understand that each byte is transformed in two hexadecimal values: one is the highIndex (first 8 bits) and the second is the lowerIndex (last 8 bits) and that each value is tranformed in its hexadecimal value from the array of hex values.
3) What I don't really understand is why the highIndex is calculated as: value >> 4
and the lowest index is calculated as value 0x0f (is this last also to eliminate negative values?)
If someone could clarify this for me, I'd be very grateful.
Thanks.
MarcoSo, does this mean that we add 256 to eliminate the sign?No. You need the whole line to convert a signed byte into an int between 0 and 255.
A simpler way to do this would be
value = data[i] & 0xFF;
This moves down the higher bits so that it turnsinto lower bits. i.e. we need it to >be between 0 and
15.
Is this shifted of 4 because Math.pow(2, 4) = 16.0?Doing in this case, x >>4 is the same as x / 16
This leaves only the lowest 4 bits.Is the following what happens?There are no char values produced. Using 0000 as an example is not a good idea as you can change it in many ways and it is still 0000
>
Received as initial value:
byte: 0000 0000
What we need to obtain:
char: 0000 0000 0000 0000
The first 4 bits of the above byte are shifted of 4
positions to find the hexadecimal equivalent (if from
2 I want to get to 16 I have to do the opposite of
powering a number by 4); The last four bits of the
byte are extracted because of the '&' operator with
0x0f (which in binary is 1111 - Therefore all the '1'
are kept)?Yes. -
I am sending data to the serial port and it must be in hexadecimal format. I'm using a method that sends a byte array to the serial port.
putData(byte[] barray);I've created a byte[] array and initialized it to the following values.
byte byteBuf[] = { 0x10, 0x40, 0x80 };
How can I be sure that the 0x prefix is being sent. Namely, how can I send the hex value in the byte array. Also, I get a
possible loss of precision error
found : int
required: byte
byte byteBuf[] = { 0x10, 0x40, 0x80 };
^ ^
Any ideas would be greatly appreciated, Cheers.Because of the way two's complement binary and signed bytes work. Your 0x80 byte is expressed in binary as 10000000. This is the equivalent of -128 in decimal by virtue of Java's bytes always being signed (the leftmost bit indicates whether the byte is positive or negative). When you run the conversion to an integer, it has the binary look of:
11111111 11111111 11111111 10000000
This is still -128 in decimal. When you then convert this to a hex String, it looks at each "octet", so the integer then becomes:
11111111 = FF
11111111 = FF
11111111 = FF
10000000 = 80
Or, FFFFFF80.
Make sense? -
Encoded double byte characters string conversion
I have double byte encoded strings stored in a properties file. A sample of such string below (I think it is japanese):
\u30fc\u30af\u306e\u30a2
I am supposed to read it from file, convert it to actual string and use them on UI. I am not able to figure how to do the conversion -- the string contains text as is, char backslash, char u, and so on. How to convert it to correct text (either using ai::UnicodeString or otherwise)?
Thanks.Where did this file come from? Some kind of Java or Ruby export? I don't think AI has anything in its SDK that would natively read that. You could just parse the string, looking for \u[4 characters]. I believe if you created a QChar and initialized it with the integer value of the four-character hex string, it would properly create the character.
Maybe you are looking for
-
CRASH "Not enough memory to create clipboard. This should never happen."
CRASH Error message: "Not enough memory to create clipboard. This should never happen." What the F??? SvK
-
Error in CCMS monitoring Batch job SAP_CCMS_MONI_BATCH_DP.
Hi All, I am using a Sanbox system for CCMS Monitoring activities. I assigned a method CCMS_ONAlert_Email under auto reaction to the MTE class ABAP shortdumps on node System errors. So the requirement is when an alert triggered i have to receive an a
-
Hi all, Does anyone can help me to solve the unability of JSF to evaluate a conditional rendered property ? My goal is to set rendered property to true or false for components having a specific id (something like PROTECTEDxxxxx where xxxxx is a resou
-
CREATIVE LABS READ THIS MICROPHONE ISSUE PLEASE!!!
i am having the exact same problem and i'm no compu-dummy .. this soundblaster li've 24-bit card just ruined my studio i have built in my house. i have so much equipment and i can't do anything with it because of this card i just bought. i really wan
-
I have Aironet 1200s that I am setting up with multiple vlans and security, I have been able to get all the vlans to work the way I want and the security to work. However I need a way to manage the AP remotely and I have not been able to get a manage