<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>miyohide</author_name>
  <author_url>https://blog.hatena.ne.jp/miyohide/</author_url>
  <blog_title>miyohide's blog</blog_title>
  <blog_url>https://miyohide.hatenablog.com/</blog_url>
  <categories>
    <anon>java</anon>
  </categories>
  <description>バイナリデータを読み込むとき、データはbyte型の変数に入るのだが、Javaのbyteは符号付き。符号なしのbyteっていうのも用意されていないので、0x00って形式で表すのはちょっとした工夫がいる。byte型は-128から127までを表すので、byte型に格納された0xFFは-1となって、int型で格納した値と比較しようとしたときにちょっとはまる。ってかはまりました。 int a = (int)b_val; if (a &lt; 0) { a += 256; } String s = Integer.toHexString(a); これでできる。</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmiyohide.hatenablog.com%2Fentry%2F20090215%2F1234701757&quot; title=&quot;バイナリデータを16進で表現したい。 - miyohide&amp;#39;s blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2009-02-15 21:42:37</published>
  <title>バイナリデータを16進で表現したい。</title>
  <type>rich</type>
  <url>https://miyohide.hatenablog.com/entry/20090215/1234701757</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
