将一个字节序列转换成Java中的jpeg文件。

时间:2022-10-14 21:15:21

I am interfacing a medical instrument with my PC using Java . The data transfer is working fine. The problem is along with the content (String), the data also contains 4 Jpeg images . The entire stream is encoded in utf-8. The problem is that I am able to extract the data for the jpeg but I am unable to save it to a file in the right format.

我正在用Java与我的电脑连接一个医疗仪器。数据传输工作正常。问题与内容(字符串)一起,数据也包含4个Jpeg图像。整个流用utf-8编码。问题是,我能够提取jpeg的数据,但我无法将其保存到正确格式的文件中。

I have looked around and the data looks fine (in that it starts with ffd8 and ends with ffd9)

我环顾四周,数据看起来很好(从ffd8开始,到ffd9结束)

I'm storing the byte data in an array _tmp. I have tried the following

我将字节数据存储在一个数组_tmp中。我已经试过了。

1) Just writing the bytes to a file

1)将字节写入文件。

FileOutputStream _fos = new FileOutputStream(_filename);
_fos.write(_image_string.getBytes());
_fos.flush()
_fos.close();

I get the following error when I try to open the file

当我试图打开文件时,我得到了以下错误。

将一个字节序列转换成Java中的jpeg文件。

I have then tried to use a BufferedImage as follows

然后我尝试使用以下的BufferedImage方法。

BufferedImage _bi = ImageIO.read(new ByteArrayInputStream(_tmp));
File _image = new File(_filename);
ImageIO.write(_bi,"jpg",_image);

For this the following exception was raised.

为此,提出了以下例外情况。

java.lang.IllegalArgumentException: image == null!  
at javax.imageio.ImageTypeSpecifier.createFromRenderedImage(Unknown Source) 
at javax.imageio.ImageIO.getWriter(Unknown Source)

The spec of the data format is pasted below.(even though it mentions BMP data - the documentation clearly mentions its in jpeg format)

数据格式的规范被粘贴在下面。(尽管它提到了BMP数据——文档清楚地提到了它的jpeg格式)

将一个字节序列转换成Java中的jpeg文件。

I realize this has something to do with the encoding. Just not able to figure it out. Any pointers would be greatly appreciated.

我意识到这和编码有关。只是不能算出来。非常感谢您的指点。

1 个解决方案

#1


0  

Your JPEG data is in a String like "FFD8FFE0 ....FFD9"?
(no spaces between hex values like FF D8 FF E0)? Remove any whitespace or non-hex chars (valid hex chars are : digits "0" up to "9" and letters "A" up to "F").

JPEG数据是在一个字符串“FFD8FFE0 .... FFD9”?(十六进制值之间没有空格,如FF D8 FF E0)?删除任何空白或非十六进制字符(有效的十六进制字符是:数字“0”到“9”,字母“A”到“F”)。

Convert the String to Bytes

将字符串转换为字节。

//# import this class
import javax.xml.bind.DatatypeConverter;

//# declare byte array
public static byte[] imageBytes;

//# String into imageBytes convert with... (writes byte integers from hex values)
imageBytes = DatatypeConverter.parseHexBinary( my_Hex_String );

Now imageBytes can be saved as file or just used as (input) JPEG data in other functions.

现在,imageBytes可以作为文件保存,也可以作为(输入)JPEG数据在其他函数中使用。

Some example code :

一些示例代码:

This should output something like below from valid JPEG string:

这应该输出如下所示的有效JPEG字符串:

Byte value 0 : -1 (which is == 0xFF)
Byte value 1 : -40 (which is == 0xD8)
Byte value 2 : -1 (which is == 0xFF)
Byte value 3 : -32 (which is == 0xE0)

字节值0:-1(即== 0xFF)字节值1:-40(即== 0xD8)字节值2:-1(即== 0xFF)字节值3:-32(即== 0xE0)

package hexstringtobytearray_v1;

import javax.xml.bind.DatatypeConverter;

public class HexStringtoByteArray_v1 
{
    public static String image_hexStr = "FFD8FFE000104A46494600010200001000190000FFFE00104C61766335372E34382E31303100FFDB0043000806060706070808080808080909090A0A0A090909090A0A0A0A0A0A0C0C0C0A0A0A0A0A0A0A0C0C0C0C0D0E0D0D0D0C0D0E0E0F0F0F1212111115151519191FFFC401A20000010501010101010100000000000000000102030405060708090A0B0100030101010101010101010000000000000102030405060708090A0B100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FA1100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFC00011080040006403011200021200031200FFDA000C03010002110311003F00EC3C4575ABDBCD64B66275B46137DAE6B4B782EAED1C05F25520B8754F2DC96DEE15D8100606735A97963F6B20F99B308571E5A3F2594EECB73FC38C74AF5EA3A978F2DEDADDC526FCB47D0A9439BAFE07C5E1961DC6A7B471E7F779235272841AD799B9455EEB4B2D11953ABECFA5F5BEED74F2393D4B51F1447013A68BC9CFF65DD3AB5D595AC5706FD6F215850C2B841FB832955E8C064F35D2FF006381E6E25037EEDBFB88BF761893819FBD827BFA56529564BDDE67EEBDE293E6E656D3D0BF67BEBF823AE94702E5FBD9538FEFA0AD0A9371F67C92727CDBFC56BF639BEB0FDDD36B5FDE7AD8CBD16F35A975211C86F26B0FB33B4B2EA3676B67325C865F2D2DD6DD8195194B1937C602E061B9C56C5BE9A96D30955871E6FCA2251F2C9B30A1872020403FDAEF4A0EA736BCCE36D5CA2A2EFE56DCA8C395DFD7A7735AF1C37B2BC5D35579D5A34AA4EA45C2CEEE5CCB469DAD67AF6319D6738F2BBFD9EAFA5F5F9DCBD59DAEEAC9A1E9B717AEA6431A80918EB24AE7089F89EBED5626EC9BEC645422E728C5349B76BBD9776FC92D4B971730DAC6659E5485075791828FCCD78DDAEB73EB37325C6A1299E4193E527FAA8107F7A46C451AAF7DBF89A61879A937CDADBA2D92FEF49E8896EDBB1E67879528C552F754B4E79FC536FA53A71F7E57E9F91E99378C7438325AECE07F12C52B03F4C2F35E2FAAF8BF4FCC9B3EDB7312B7965ACC2C300241C21B9911E466201FBAA8B81F2E7AD36ACAEDA4615F1F46ED5E73FF00AF768C7FF0292727F249111973CB9631937E9A7E363D0C070EE3B923271C3D17BFFB473D59FF00E0AA6E34E3E92729773D813E20F859FA6A91019C162930553E8EC530A7EB5E31A32D9F88FCDB7B2D1AED1580135D3DE0291F5EACE9C9FF00657E63E957ED61FCF1FBCC294E8D7BC63426AFBCBDA5EDF7A30784C4A76F6352FBA56DD775DFE47A18BA18FCBF92AD5CC284F97E0A4B0CE2E5E49465B79BD0FA1EDAEA0BC8527B79639E2719592260E8C3D9864579CF8474EBEF091741782E6D1FFE5D9964F94FF795CBB053F44E7BD755EE2A547D92B73DE3D37BAFC4F25A716D34D35BA7A34698BC63C64A33587E4A9F6DA6B964BD1453BF9B6CF4BAC44F12C19FDEC3220FEF290F8FC30A7F2A63692EA64115397D968DBA6C6EB2C692A1DD1B80CAE3EE907DE909493D9A02A74E70F8A2D6DD34D7CF61D453024028A000028A000028A0000B56964F759C1551EA4F3F5DBDFF004A8FED530C6D6D98007CBC640E99ED58D6C42A3D1B7FD752BD8C1DEEAFD75D4EDC0E5D531B7B38C5776F5F551DDFE08C9636BC6DCB3E46925786974B6BF4D0D03A3053CCDF2FD39FE78ACE92E269461DD987A1AE7FAF37B435F5D0E98D2841DD4523D379028BF7B10943BF2EBF8BB1E555C557ACB96A54949766CE27E252CD3597D82DD8664219262AE72CA595936A0255429C97CE3B715D2EA5A645A9468ACED1B293870B9C03D46091907EA2AE309D6A326BDD93B24B57BEBD3C8AA75654EF649F95F7FF00232A95E860B1D4D4AF56941CA4E578C2F6D1692766EFB2D6FBA31C46169E25439A4E2D3DD46F6F95D5FBF43E76F18B3689A7D8E936EE713C667BA947CA6621B0138E880F3B7E95E97AFF00807C35AA5DDA0D4359BBB616F2184A1B270263211B52398160A4B636E41CE6B8F1FF00ECD4E9E1E2FE25CF37B736BA2F42331E793A73945455B955A5CDE7AF63DDE1E4B34C462732AD1D69D4F638783D5524A29CA5AFDA774AE6FC2EA852A788A34AACEA494D54973D2F67D141B8EAEEAF6BF63C5ACF5ABF974F8F4154B696DA6BA0EA1E056956690850C920C4808ED8E7923A715F57E85E1CF0668A9B2C74EB485A40A5A431E642546D04B3EE653DF03033938CD7101EF0CF2F6B3BAD16C6DADB4D898C71858FF7620E38E6595A6DE4863CB6D4635B27CCB5965825EB148C9F829E0FE239AE9559D28A50DBCAC797F58716E2FA3B1E74B2E589A8E557DE93E8EEBE4AD6FCCFB4595D3C4421569EAA715256F339BD2754F124F7D3DBDEDBDB35AC5FF2F48A577E7A796EADB1F1FC5FBB5AD2D4F5FD36CC6C9350B285C9FB92CBF37FDF2A770FC702BD48E32A3DED63CD556735EEA6CF8B9645417C2A517D15EF7FD4FAE9E130D869DAAD4A709769495D7AADCCDD7B5FBCB07920B3D39EF258E369646276451C6A32CD9E37633F754E4F6A4B0D593519AE1CFD9678DDC24696D20B8DEC381D87CCD9036E2BD2962DAD0F2A5564A4959DDF4B75F23E4A192C6CA4F9ACF5D11F6B43094AA5194D54A5ECE9DFDF8CD34A2B56E5B5ADE67A57C24D44EB9E1533DC84606FE708AB1C91AA80B192A048EE4E189F981C1CD749A1D90D1B48B681F646C10BC8131859243B99463AEDC85E3D2BD15566E5CE9D9EDA0B0F4E5651B7BDD7D4F8EAB85C3AA6A94E3CF1BF35A5DC79AE2E94AAD4AB19AF657B45DFECAD13F9EFF3197969F663B81CA13C75E3DA8BBB8130015DB1DD48C0FAD77D0AFED559E8D21D1A4E0F58ABF7EA7CD63F01F547CE9F3537276DD5BB20C762D574942A4F97AC1AB2F5BEE55208A56666392727A7E55AA770494744714A2E2F5FE9771CA729BBC9DDD92F921B453024028A000028A000028A000028A0000E6B5ED7355B1BB78E09630A151951E3460415E99C67A83CD41AE3C5737FF290DB2208D8E8486CFE99C563528D269DD7E2CC6B578FB4B277B2D4F47098DC5C795C6764B45EEC7A74DB547A196E595BEA8A738B8F3CF9A375ADADFADAE717A8F8E35F8DDA38EE25B16C9E52C16EE361EA1D19641F88E2BA808ABD005E3A818E2B96741C5FBAEFE4D3FCE37FC8E8FAC247A9431D4EA413AB0707D654E51B7FE0151C5AF94D9C6F2B6FA36725E1ED4B58D6350CDF6A7F69470A85A5B0FB3C7101D18BAFEF09C7186E3D4D6BEB8B7173672C56D2C7048DC0790B6CC13F367690DCAE4023919AE1797BC54B56A9FF00795DBFBAC91D553137564EC7BB478A61925292A71A98B4F55467C94D45F56A6A7525F24AC79786CA391F338737C8BDAD7C37B7D6C077F25D881B6789FCB765ED93B1D587A673ED5CDE9FE208FC291AC697E026ED8B6F1BCB71B9FD36BEE193D80C9AE459463293FDDD5A525E7CCBF0B3FC19D30C4BA7B3F97FC39EBD5E3AE1EC7C7FDAF018EA3516EE92A3297A73F3C2FF00F6F44F2F139452C47F1611BFF368A5F2E5D4ED7C21E01B1F0B132FCB34FCED38C84CFF0016E20177C7009002F614FB5F155ECB0C72C9681030C94903472E3D48DCC17239C119F515A6132E74A6AAD79AA9517C2A37508FA5F765AC73DDC51C39DF15431742782CB684B0B849FF0016555C6588AFE5371F7630FEEA6EFDCCE5C3306DA8D5A89F4D135FA3FC4EB7248C12715434CD560D523668F2AC870F19232B9E878EA0FAD76597633A35E15D371DD6E8F9D726D59B6D2E973B332CAF11964E31AAAF19A6E1357B4ADBAF26BB17A8AD40E200A280000A280000A280000A2800031B5AD6FEC04410806775DD96FBB1A9E848EEC7B0E9EB5A725A5BCADBE482276E9B9A356381EE466BCFCC3325856A9C2CEA357D768AFF003EC764F0F46A3E69D2A727DE508B7F7B47D5709F084F3D8CB195DCA38484DC128E93AD38D9B8A7F660AEB99EF7D11E050CD330C2D354A863315469A6DA852AF5610BBDDF2C6495DF53847BA9A42CD24D248CDDD989E7D8741F85773F61B4FF009F683FEFD27F857CDCB1B3936E536DBEECFA2FAA61FF00E7CD2FFC023FE47EBB4F87A8518C614B0D4E9C63B28C12FBDDAEFE67E4DFDB99B7FD0C71DFF8555BFF00933848988C9EB9239AEE5F4EB2931BADA1E3D102FF00E838AF9C5897DCFA196070B3DE853F9452FCAC7EBB53288E8B9765D8FC9E8712677866DD3CCB18AFBF35694D7DD53991E79AE6A2D6B6F88CED760D86F4C0249FAFA577E745D31BEFD95B3F047EF230FC1EBF7F775AF01E25BB23DF8603090D63429FDD7FCEE7EA71CA1538CA6E2BADB4ECAE7E5B88E26CF315151AB9962E514EF6553915FF00EE1F29F2D5D6BBAB6A53187ED333EF6202A9C679F6AFA6D3C29E1E88EE8F47D3636CE7725A428D9FF795437EB5E4D9455D9ECCB0D4271E5952835DAC7D94AB57AF53D9C5B6DBB25156FC8F85A19BE6386A8AAD2C66221516D2551DFF001BA3C9FC15E115B1097D7BFBDB8C7EEC3722107BAE7F88F73D6BD8BFB1B4FC63ECEA07A0671FC9ABE7A5894DE9B2FC4F69E55827FF002E52F494D7FEDC7EA987C925469A7535AB25B7F227D3D5F53F3D8F1AF11475FED09C9F79D2A12FCE99E7DAB6A1E4A10BD6BB86F0BE8CE72F66AE7FDB7948FCB7E2BC278972764CF7639560A3B515F394DFE723F4C86511A51E79475E87E695B8DF88EBAB4B309A5FDDA5423F8C69A673BF0EACE7F2EF2FE52DB67611479FE20872CDF407007E35DADBDBC3691243046B14518C246830AA339E07D6B0CA6126A755ECFDD5E76D5BFD0F46108D38A8C528C56C96C8F438EABC213C360D59D48DEB54FEEA92E5847D5ABCBD2C7C9D7C456C5559D6AF52556ACDDE539BBCA4ED6D5FA1251540660145000014500007FFD9";
    public static byte[] imageBytes;

    public static void main(String[] args) 
    {
        //run conversion function (convert hex values in String into Byte integers)
        imageBytes = HexStringToByteArray( image_hexStr );

        System.out.println("Byte value 0 : "  + imageBytes[0] );
        System.out.println("Byte value 1 : "  + imageBytes[1] );
        System.out.println("Byte value 2 : "  + imageBytes[2] );
        System.out.println("Byte value 3 : "  + imageBytes[3] );
    }

    public static byte[] HexStringToByteArray(String input) 
    { return DatatypeConverter.parseHexBinary( input ); }

}

#1


0  

Your JPEG data is in a String like "FFD8FFE0 ....FFD9"?
(no spaces between hex values like FF D8 FF E0)? Remove any whitespace or non-hex chars (valid hex chars are : digits "0" up to "9" and letters "A" up to "F").

JPEG数据是在一个字符串“FFD8FFE0 .... FFD9”?(十六进制值之间没有空格,如FF D8 FF E0)?删除任何空白或非十六进制字符(有效的十六进制字符是:数字“0”到“9”,字母“A”到“F”)。

Convert the String to Bytes

将字符串转换为字节。

//# import this class
import javax.xml.bind.DatatypeConverter;

//# declare byte array
public static byte[] imageBytes;

//# String into imageBytes convert with... (writes byte integers from hex values)
imageBytes = DatatypeConverter.parseHexBinary( my_Hex_String );

Now imageBytes can be saved as file or just used as (input) JPEG data in other functions.

现在,imageBytes可以作为文件保存,也可以作为(输入)JPEG数据在其他函数中使用。

Some example code :

一些示例代码:

This should output something like below from valid JPEG string:

这应该输出如下所示的有效JPEG字符串:

Byte value 0 : -1 (which is == 0xFF)
Byte value 1 : -40 (which is == 0xD8)
Byte value 2 : -1 (which is == 0xFF)
Byte value 3 : -32 (which is == 0xE0)

字节值0:-1(即== 0xFF)字节值1:-40(即== 0xD8)字节值2:-1(即== 0xFF)字节值3:-32(即== 0xE0)

package hexstringtobytearray_v1;

import javax.xml.bind.DatatypeConverter;

public class HexStringtoByteArray_v1 
{
    public static String image_hexStr = "FFD8FFE000104A46494600010200001000190000FFFE00104C61766335372E34382E31303100FFDB0043000806060706070808080808080909090A0A0A090909090A0A0A0A0A0A0C0C0C0A0A0A0A0A0A0A0C0C0C0C0D0E0D0D0D0C0D0E0E0F0F0F1212111115151519191FFFC401A20000010501010101010100000000000000000102030405060708090A0B0100030101010101010101010000000000000102030405060708090A0B100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FA1100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFC00011080040006403011200021200031200FFDA000C03010002110311003F00EC3C4575ABDBCD64B66275B46137DAE6B4B782EAED1C05F25520B8754F2DC96DEE15D8100606735A97963F6B20F99B308571E5A3F2594EECB73FC38C74AF5EA3A978F2DEDADDC526FCB47D0A9439BAFE07C5E1961DC6A7B471E7F779235272841AD799B9455EEB4B2D11953ABECFA5F5BEED74F2393D4B51F1447013A68BC9CFF65DD3AB5D595AC5706FD6F215850C2B841FB832955E8C064F35D2FF006381E6E25037EEDBFB88BF761893819FBD827BFA56529564BDDE67EEBDE293E6E656D3D0BF67BEBF823AE94702E5FBD9538FEFA0AD0A9371F67C92727CDBFC56BF639BEB0FDDD36B5FDE7AD8CBD16F35A975211C86F26B0FB33B4B2EA3676B67325C865F2D2DD6DD8195194B1937C602E061B9C56C5BE9A96D30955871E6FCA2251F2C9B30A1872020403FDAEF4A0EA736BCCE36D5CA2A2EFE56DCA8C395DFD7A7735AF1C37B2BC5D35579D5A34AA4EA45C2CEEE5CCB469DAD67AF6319D6738F2BBFD9EAFA5F5F9DCBD59DAEEAC9A1E9B717AEA6431A80918EB24AE7089F89EBED5626EC9BEC645422E728C5349B76BBD9776FC92D4B971730DAC6659E5485075791828FCCD78DDAEB73EB37325C6A1299E4193E527FAA8107F7A46C451AAF7DBF89A61879A937CDADBA2D92FEF49E8896EDBB1E67879528C552F754B4E79FC536FA53A71F7E57E9F91E99378C7438325AECE07F12C52B03F4C2F35E2FAAF8BF4FCC9B3EDB7312B7965ACC2C300241C21B9911E466201FBAA8B81F2E7AD36ACAEDA4615F1F46ED5E73FF00AF768C7FF0292727F249111973CB9631937E9A7E363D0C070EE3B923271C3D17BFFB473D59FF00E0AA6E34E3E92729773D813E20F859FA6A91019C162930553E8EC530A7EB5E31A32D9F88FCDB7B2D1AED1580135D3DE0291F5EACE9C9FF00657E63E957ED61FCF1FBCC294E8D7BC63426AFBCBDA5EDF7A30784C4A76F6352FBA56DD775DFE47A18BA18FCBF92AD5CC284F97E0A4B0CE2E5E49465B79BD0FA1EDAEA0BC8527B79639E2719592260E8C3D9864579CF8474EBEF091741782E6D1FFE5D9964F94FF795CBB053F44E7BD755EE2A547D92B73DE3D37BAFC4F25A716D34D35BA7A34698BC63C64A33587E4A9F6DA6B964BD1453BF9B6CF4BAC44F12C19FDEC3220FEF290F8FC30A7F2A63692EA64115397D968DBA6C6EB2C692A1DD1B80CAE3EE907DE909493D9A02A74E70F8A2D6DD34D7CF61D453024028A000028A000028A0000B56964F759C1551EA4F3F5DBDFF004A8FED530C6D6D98007CBC640E99ED58D6C42A3D1B7FD752BD8C1DEEAFD75D4EDC0E5D531B7B38C5776F5F551DDFE08C9636BC6DCB3E46925786974B6BF4D0D03A3053CCDF2FD39FE78ACE92E269461DD987A1AE7FAF37B435F5D0E98D2841DD4523D379028BF7B10943BF2EBF8BB1E555C557ACB96A54949766CE27E252CD3597D82DD8664219262AE72CA595936A0255429C97CE3B715D2EA5A645A9468ACED1B293870B9C03D46091907EA2AE309D6A326BDD93B24B57BEBD3C8AA75654EF649F95F7FF00232A95E860B1D4D4AF56941CA4E578C2F6D1692766EFB2D6FBA31C46169E25439A4E2D3DD46F6F95D5FBF43E76F18B3689A7D8E936EE713C667BA947CA6621B0138E880F3B7E95E97AFF00807C35AA5DDA0D4359BBB616F2184A1B270263211B52398160A4B636E41CE6B8F1FF00ECD4E9E1E2FE25CF37B736BA2F42331E793A73945455B955A5CDE7AF63DDE1E4B34C462732AD1D69D4F638783D5524A29CA5AFDA774AE6FC2EA852A788A34AACEA494D54973D2F67D141B8EAEEAF6BF63C5ACF5ABF974F8F4154B696DA6BA0EA1E056956690850C920C4808ED8E7923A715F57E85E1CF0668A9B2C74EB485A40A5A431E642546D04B3EE653DF03033938CD7101EF0CF2F6B3BAD16C6DADB4D898C71858FF7620E38E6595A6DE4863CB6D4635B27CCB5965825EB148C9F829E0FE239AE9559D28A50DBCAC797F58716E2FA3B1E74B2E589A8E557DE93E8EEBE4AD6FCCFB4595D3C4421569EAA715256F339BD2754F124F7D3DBDEDBDB35AC5FF2F48A577E7A796EADB1F1FC5FBB5AD2D4F5FD36CC6C9350B285C9FB92CBF37FDF2A770FC702BD48E32A3DED63CD556735EEA6CF8B9645417C2A517D15EF7FD4FAE9E130D869DAAD4A709769495D7AADCCDD7B5FBCB07920B3D39EF258E369646276451C6A32CD9E37633F754E4F6A4B0D593519AE1CFD9678DDC24696D20B8DEC381D87CCD9036E2BD2962DAD0F2A5564A4959DDF4B75F23E4A192C6CA4F9ACF5D11F6B43094AA5194D54A5ECE9DFDF8CD34A2B56E5B5ADE67A57C24D44EB9E1533DC84606FE708AB1C91AA80B192A048EE4E189F981C1CD749A1D90D1B48B681F646C10BC8131859243B99463AEDC85E3D2BD15566E5CE9D9EDA0B0F4E5651B7BDD7D4F8EAB85C3AA6A94E3CF1BF35A5DC79AE2E94AAD4AB19AF657B45DFECAD13F9EFF3197969F663B81CA13C75E3DA8BBB8130015DB1DD48C0FAD77D0AFED559E8D21D1A4E0F58ABF7EA7CD63F01F547CE9F3537276DD5BB20C762D574942A4F97AC1AB2F5BEE55208A56666392727A7E55AA770494744714A2E2F5FE9771CA729BBC9DDD92F921B453024028A000028A000028A000028A0000E6B5ED7355B1BB78E09630A151951E3460415E99C67A83CD41AE3C5737FF290DB2208D8E8486CFE99C563528D269DD7E2CC6B578FB4B277B2D4F47098DC5C795C6764B45EEC7A74DB547A196E595BEA8A738B8F3CF9A375ADADFADAE717A8F8E35F8DDA38EE25B16C9E52C16EE361EA1D19641F88E2BA808ABD005E3A818E2B96741C5FBAEFE4D3FCE37FC8E8FAC247A9431D4EA413AB0707D654E51B7FE0151C5AF94D9C6F2B6FA36725E1ED4B58D6350CDF6A7F69470A85A5B0FB3C7101D18BAFEF09C7186E3D4D6BEB8B7173672C56D2C7048DC0790B6CC13F367690DCAE4023919AE1797BC54B56A9FF00795DBFBAC91D553137564EC7BB478A61925292A71A98B4F55467C94D45F56A6A7525F24AC79786CA391F338737C8BDAD7C37B7D6C077F25D881B6789FCB765ED93B1D587A673ED5CDE9FE208FC291AC697E026ED8B6F1BCB71B9FD36BEE193D80C9AE459463293FDDD5A525E7CCBF0B3FC19D30C4BA7B3F97FC39EBD5E3AE1EC7C7FDAF018EA3516EE92A3297A73F3C2FF00F6F44F2F139452C47F1611BFF368A5F2E5D4ED7C21E01B1F0B132FCB34FCED38C84CFF0016E20177C7009002F614FB5F155ECB0C72C9681030C94903472E3D48DCC17239C119F515A6132E74A6AAD79AA9517C2A37508FA5F765AC73DDC51C39DF15431742782CB684B0B849FF0016555C6588AFE5371F7630FEEA6EFDCCE5C3306DA8D5A89F4D135FA3FC4EB7248C12715434CD560D523668F2AC870F19232B9E878EA0FAD76597633A35E15D371DD6E8F9D726D59B6D2E973B332CAF11964E31AAAF19A6E1357B4ADBAF26BB17A8AD40E200A280000A280000A280000A2800031B5AD6FEC04410806775DD96FBB1A9E848EEC7B0E9EB5A725A5BCADBE482276E9B9A356381EE466BCFCC3325856A9C2CEA357D768AFF003EC764F0F46A3E69D2A727DE508B7F7B47D5709F084F3D8CB195DCA38484DC128E93AD38D9B8A7F660AEB99EF7D11E050CD330C2D354A863315469A6DA852AF5610BBDDF2C6495DF53847BA9A42CD24D248CDDD989E7D8741F85773F61B4FF009F683FEFD27F857CDCB1B3936E536DBEECFA2FAA61FF00E7CD2FFC023FE47EBB4F87A8518C614B0D4E9C63B28C12FBDDAEFE67E4DFDB99B7FD0C71DFF8555BFF00933848988C9EB9239AEE5F4EB2931BADA1E3D102FF00E838AF9C5897DCFA196070B3DE853F9452FCAC7EBB53288E8B9765D8FC9E8712677866DD3CCB18AFBF35694D7DD53991E79AE6A2D6B6F88CED760D86F4C0249FAFA577E745D31BEFD95B3F047EF230FC1EBF7F775AF01E25BB23DF8603090D63429FDD7FCEE7EA71CA1538CA6E2BADB4ECAE7E5B88E26CF315151AB9962E514EF6553915FF00EE1F29F2D5D6BBAB6A53187ED333EF6202A9C679F6AFA6D3C29E1E88EE8F47D3636CE7725A428D9FF795437EB5E4D9455D9ECCB0D4271E5952835DAC7D94AB57AF53D9C5B6DBB25156FC8F85A19BE6386A8AAD2C66221516D2551DFF001BA3C9FC15E115B1097D7BFBDB8C7EEC3722107BAE7F88F73D6BD8BFB1B4FC63ECEA07A0671FC9ABE7A5894DE9B2FC4F69E55827FF002E52F494D7FEDC7EA987C925469A7535AB25B7F227D3D5F53F3D8F1AF11475FED09C9F79D2A12FCE99E7DAB6A1E4A10BD6BB86F0BE8CE72F66AE7FDB7948FCB7E2BC278972764CF7639560A3B515F394DFE723F4C86511A51E79475E87E695B8DF88EBAB4B309A5FDDA5423F8C69A673BF0EACE7F2EF2FE52DB67611479FE20872CDF407007E35DADBDBC3691243046B14518C246830AA339E07D6B0CA6126A755ECFDD5E76D5BFD0F46108D38A8C528C56C96C8F438EABC213C360D59D48DEB54FEEA92E5847D5ABCBD2C7C9D7C456C5559D6AF52556ACDDE539BBCA4ED6D5FA1251540660145000014500007FFD9";
    public static byte[] imageBytes;

    public static void main(String[] args) 
    {
        //run conversion function (convert hex values in String into Byte integers)
        imageBytes = HexStringToByteArray( image_hexStr );

        System.out.println("Byte value 0 : "  + imageBytes[0] );
        System.out.println("Byte value 1 : "  + imageBytes[1] );
        System.out.println("Byte value 2 : "  + imageBytes[2] );
        System.out.println("Byte value 3 : "  + imageBytes[3] );
    }

    public static byte[] HexStringToByteArray(String input) 
    { return DatatypeConverter.parseHexBinary( input ); }

}