Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!multikabel.net!newsfeed20.multikabel.net!newsfeeder.ewetel.de!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 08 May 2013 03:06:10 -0500 Date: Wed, 08 May 2013 09:06:09 +0100 From: lipska the kat <"nospam at neversurrender dot co dot uk"> Organization: Trollbusters 3 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: How to convert image into Hex 2 Dimensional Array? References: <41718873-b1a6-4b97-bbbb-8002c48d4e29@googlegroups.com> In-Reply-To: <41718873-b1a6-4b97-bbbb-8002c48d4e29@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 38 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-7wG5cchZ5l4IGf9V4f/2bF6pUqYcjqtaAJUlvSSv/9gYTGwyJUrodkJhDU+LVFeHLz9tC69ogmWIa4T!yJo+m8MlpyaJ7uA80h6kAXXkPQKmxyUCqadpCHRbiE/XSj2zniaVNoqBO24UxC9NwUBN8Wu7NeY= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2217 Xref: csiph.com comp.lang.java.programmer:23919 On 08/05/13 07:30, sout saret wrote: > Dear Community! > > May you help me how to write code in java to convert image to Hex 2 dimensional array. I want to show format as below: [snip] hmm, sounds like homework. 1. get hold of the javadoc for your chosen Java version Then ... To get you started. import javax.swing.ImageIcon; public class ImageToHex { public static void main(String[] args) { ImageIcon ii = new ImageIcon("/path/to/image.ext"); Integer width = ii.getIconWidth(); Integer height = ii.getIconHeight(); Byte[][] bytes = new Byte[width][height]; //you now have 2 dimensional array into which //you can read your image bytes //the rest is up to you I guess } } I'm sure there are other/better ways of doing it lipska -- Lipska the KatŠ: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun