<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>uehaj</author_name>
  <author_url>https://blog.hatena.ne.jp/uehaj/</author_url>
  <blog_title>uehaj's blog </blog_title>
  <blog_url>https://uehaj.hatenablog.com/</blog_url>
  <categories>
    <anon>groovy</anon>
  </categories>
  <description>IPv4アドレスのマスクの変換もやってみた。投稿したあとでゲンゾウさんのを見ると、「Integer/Long.toBinaryString」というメソッドやcountというメソッドを使ってたのでさすがと思いました。以下はそれを取り込んだバージョン。 def netMask(addr) { Long.toString(addr.split(/\./).inject(0){a,b-&gt;a*256+(b as long)},2).count('1') } assert netMask(&quot;255.255.255.0&quot;)==24 assert netMask(&quot;255.255.255.128&quot;)==25 …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fuehaj.hatenablog.com%2Fentry%2F20090808%2F1249699687&quot; title=&quot;どう書く.org課題「 IPv4アドレスのマスクの変換 」 - uehaj&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-08-08 11:48:07</published>
  <title>どう書く.org課題「 IPv4アドレスのマスクの変換 」</title>
  <type>rich</type>
  <url>https://uehaj.hatenablog.com/entry/20090808/1249699687</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
